diff options
| author | Alasdair Armstrong | 2019-05-03 17:28:30 +0100 |
|---|---|---|
| committer | Alasdair Armstrong | 2019-05-03 17:28:30 +0100 |
| commit | f6ad93e7cbbb3e43b045ae3313e556ea70e54c8f (patch) | |
| tree | c6f1bc2e499046cb7e5c22f750e0e63162f6d253 /lib | |
| parent | c7a3389c34eebac4fed7764f339f4cd1b2b204f7 (diff) | |
Jib: Fix optimizations for SMT IR changes
Fixes C backend optimizations that were disabled due to changes in the
IR while working on the SMT generation.
Also add a -Oaarch64_fast option that optimizes any integer within a
struct to be an int64_t, which is safe for the ARM v8.5 spec and
improves performance significantly (reduces Linux boot times by 4-5
minutes). Eventually this should probably be a directive that can be
attached to any arbitrary struct/type.
Fixes the -c_specialize option for ARM v8.5. However this only gives a
very small performance improvment for a very large increase in
compilation time however.
Diffstat (limited to 'lib')
| -rw-r--r-- | lib/sail.c | 51 | ||||
| -rw-r--r-- | lib/sail.h | 5 |
2 files changed, 49 insertions, 7 deletions
@@ -1017,15 +1017,11 @@ void slice(lbits *rop, const lbits op, const sail_int start_mpz, const sail_int } } -inline +__attribute__((target ("bmi2"))) sbits sslice(const fbits op, const mach_int start, const mach_int len) { sbits rop; -#ifdef INTRINSICS rop.bits = _bzhi_u64(op >> start, len); -#else - rop.bits = (op >> start) & safe_rshift(UINT64_MAX, 64 - len); -#endif rop.len = len; return rop; } @@ -1126,18 +1122,25 @@ void reverse_endianness(lbits *rop, const lbits op) } } -inline bool eq_sbits(const sbits op1, const sbits op2) { return op1.bits == op2.bits; } -inline bool neq_sbits(const sbits op1, const sbits op2) { return op1.bits != op2.bits; } +__attribute__((target ("bmi2"))) +sbits not_sbits(const sbits op) +{ + sbits rop; + rop.bits = (~op.bits) & _bzhi_u64(UINT64_MAX, op.len); + rop.len = op.len; + return rop; +} + sbits xor_sbits(const sbits op1, const sbits op2) { sbits rop; @@ -1146,6 +1149,40 @@ sbits xor_sbits(const sbits op1, const sbits op2) return rop; } +sbits or_sbits(const sbits op1, const sbits op2) +{ + sbits rop; + rop.bits = op1.bits | op2.bits; + rop.len = op1.len; + return rop; +} + +sbits and_sbits(const sbits op1, const sbits op2) +{ + sbits rop; + rop.bits = op1.bits & op2.bits; + rop.len = op1.len; + return rop; +} + +__attribute__((target ("bmi2"))) +sbits add_sbits(const sbits op1, const sbits op2) +{ + sbits rop; + rop.bits = (op1.bits + op2.bits) & _bzhi_u64(UINT64_MAX, op1.len); + rop.len = op1.len; + return rop; +} + +__attribute__((target ("bmi2"))) +sbits sub_sbits(const sbits op1, const sbits op2) +{ + sbits rop; + rop.bits = (op1.bits - op2.bits) & _bzhi_u64(UINT64_MAX, op1.len); + rop.len = op1.len; + return rop; +} + /* ***** Sail Reals ***** */ void CREATE(real)(real *rop) @@ -333,7 +333,12 @@ void reverse_endianness(lbits*, lbits); bool eq_sbits(const sbits op1, const sbits op2); bool neq_sbits(const sbits op1, const sbits op2); +sbits not_sbits(const sbits op); sbits xor_sbits(const sbits op1, const sbits op2); +sbits or_sbits(const sbits op1, const sbits op2); +sbits and_sbits(const sbits op1, const sbits op2); +sbits add_sbits(const sbits op1, const sbits op2); +sbits sub_sbits(const sbits op1, const sbits op2); /* ***** Sail reals ***** */ |
