aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/example.c
diff options
authorLuc Van Oostenryck <luc.vanoostenryck@gmail.com>2017-08-14 15:05:24 +0200
committerLuc Van Oostenryck <luc.vanoostenryck@gmail.com>2018-06-23 07:46:40 +0200
commit52856c815a191b73530557133bd44ec478f3fece (patch)
tree453cf39d9723ab4435b4d7b871317b502d4e8058 /example.c
parent55cac5336b14524ebc371bcee006e2b497d84c5f (diff)
downloadsparse-dev-52856c815a191b73530557133bd44ec478f3fece.tar.gz
cast: specialize floats to integer conversion
Currently, casts from floats to integers are processed like integers (or any other type) to integers. This is simple but rather unconvenient as it correspond to different operations that obeys to different rules and which later need extra checks. Change this by directly using specific instructions: - FCVTU for floats to unsigned integers - FCVTS for floats to signed integers Signed-off-by: Luc Van Oostenryck <luc.vanoostenryck@gmail.com>
Diffstat (limited to 'example.c')
-rw-r--r--example.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/example.c b/example.c
index d052014e..8f0869c9 100644
--- a/example.c
+++ b/example.c
@@ -76,6 +76,8 @@ static const char *opcodes[] = {
[OP_COPY] = "copy",
[OP_CAST] = "cast",
[OP_SCAST] = "scast",
+ [OP_FCVTU] = "fcvtu",
+ [OP_FCVTS] = "fcvts",
[OP_UCVTF] = "ucvtf",
[OP_SCVTF] = "scvtf",
[OP_FCVTF] = "fcvtf",
@@ -1412,6 +1414,7 @@ static void generate_one_insn(struct instruction *insn, struct bb_state *state)
break;
case OP_CAST: case OP_SCAST: case OP_PTRCAST:
+ case OP_FCVTU: case OP_FCVTS:
case OP_UCVTF: case OP_SCVTF:
case OP_FCVTF:
generate_cast(state, insn);