aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/example.c
diff options
authorLuc Van Oostenryck <luc.vanoostenryck@gmail.com>2017-08-16 09:52:54 +0200
committerLuc Van Oostenryck <luc.vanoostenryck@gmail.com>2018-06-23 07:46:40 +0200
commitc6d4716f71de8de9683464b677207304583dc2a0 (patch)
tree9b49d056f48ae59fe666f75fe47aa8492090e0a3 /example.c
parentd0694a238744b642714e7cd226193dd1365176d0 (diff)
downloadsparse-dev-c6d4716f71de8de9683464b677207304583dc2a0.tar.gz
cast: specialize FPCAST into [USF]CVTF
Currently, all casts to a floating point type use OP_FPCAST. This is maybe simple but rather uncovenient as it correspond to several quite different operations that later need extra checks. Change this by directly using different instructions for the different cases: - FCVTF for float-float conversions - UCVTF for unsigned integer to floats - SCVTF for signed integer to floats and reject attempts to cast a pointer to a float. Signed-off-by: Luc Van Oostenryck <luc.vanoostenryck@gmail.com>
Diffstat (limited to 'example.c')
-rw-r--r--example.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/example.c b/example.c
index 00f20eb9..d052014e 100644
--- a/example.c
+++ b/example.c
@@ -76,7 +76,9 @@ static const char *opcodes[] = {
[OP_COPY] = "copy",
[OP_CAST] = "cast",
[OP_SCAST] = "scast",
- [OP_FPCAST] = "fpcast",
+ [OP_UCVTF] = "ucvtf",
+ [OP_SCVTF] = "scvtf",
+ [OP_FCVTF] = "fcvtf",
[OP_PTRCAST] = "ptrcast",
[OP_CALL] = "call",
[OP_SLICE] = "slice",
@@ -1409,7 +1411,9 @@ static void generate_one_insn(struct instruction *insn, struct bb_state *state)
generate_compare(state, insn);
break;
- case OP_CAST: case OP_SCAST: case OP_FPCAST: case OP_PTRCAST:
+ case OP_CAST: case OP_SCAST: case OP_PTRCAST:
+ case OP_UCVTF: case OP_SCVTF:
+ case OP_FCVTF:
generate_cast(state, insn);
break;