aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/validation/expand
diff options
authorLuc Van Oostenryck <luc.vanoostenryck@gmail.com>2017-08-15 11:24:01 +0200
committerLuc Van Oostenryck <luc.vanoostenryck@gmail.com>2018-06-23 07:46:40 +0200
commit01951278a60490735677920c86f139d627b22dbf (patch)
tree44e9168eacaf2053a4b96bc52a4fb38b288e07a2 /validation/expand
parentbf21036518acf0c3069c9c9e12b13fd09c8cdceb (diff)
downloadsparse-dev-01951278a60490735677920c86f139d627b22dbf.tar.gz
cast: specialize integer casts
Casts to integer used to be done with only 2 instructions: OP_CAST & OP_SCAST. Those are not very convenient as they don't reflect the real operations that need to be done. This patch specialize these instructions in: - OP_TRUNC, for casts to a smaller type - OP_ZEXT, for casts that need a zero extension - OP_SEXT, for casts that need a sign extension - Integer-to-integer casts of the same size are considered as a NOPs and are, in fact, never emitted. Signed-off-by: Luc Van Oostenryck <luc.vanoostenryck@gmail.com>
Diffstat (limited to 'validation/expand')
-rw-r--r--validation/expand/builtin-expect.c8
1 files changed, 3 insertions, 5 deletions
diff --git a/validation/expand/builtin-expect.c b/validation/expand/builtin-expect.c
index a80176a5..77f714ef 100644
--- a/validation/expand/builtin-expect.c
+++ b/validation/expand/builtin-expect.c
@@ -41,7 +41,7 @@ void *fptr(void *a)
flia:
.L0:
<entry-point>
- scast.32 %r2 <- (64) %arg1
+ trunc.32 %r2 <- (64) %arg1
ret.32 %r2
@@ -54,7 +54,7 @@ flic:
fila:
.L4:
<entry-point>
- scast.64 %r6 <- (32) %arg1
+ sext.64 %r6 <- (32) %arg1
ret.64 %r6
@@ -79,9 +79,7 @@ fils:
fptr:
.L12:
<entry-point>
- cast.64 %r12 <- (64) %arg1
- scast.64 %r13 <- (64) %r12
- ret.64 %r13
+ ret.64 %arg1
* check-output-end