Commit Graph

520 Commits

Author SHA1 Message Date
Dan Gohman
50b7d2827d Bump version to 0.46.1 2019-10-15 11:11:48 -07:00
Dan Gohman
ac4e93f971 Bump version to 0.46.0 2019-10-15 09:43:28 -07:00
Andrew Brown
1f728c1797 Add x86 legalization for SIMD bnot 2019-10-11 11:05:24 -07:00
Andrew Brown
dbe7dd59da Add x86 SIMD bxor 2019-10-11 11:05:24 -07:00
Andrew Brown
4cdc1e76a4 Add x86 SIMD band 2019-10-11 11:05:24 -07:00
Ujjwal Sharma
f1c25c2c5a [codegen] legalize imul for 64-bit and 128-bit operands
Add a legalization that legalizes imul.I64 for 32-bit ISAs and imul.I128
for 64-bit (and subsequently 32-bit) ISAs.

Refs: https://github.com/bnjbvr/cranelift-x86/issues/4
2019-10-10 17:39:40 +02:00
Ujjwal Sharma
c062f12d7c [codegen] legalize icmp for 64 and 128 bit operands
Add legalizations for icmp and icmp_imm for i64 and i128 operands for
the narrow legalization set, allowing 32-bit ISAs (like x86-32) to
compare 64-bit integers and all ISAs to compare 128-bit integers.

Fixes: https://github.com/bnjbvr/cranelift-x86/issues/2
2019-10-10 11:06:19 +02:00
bjorn3
68b671e0ee Fix isplit legalization for ebb params when jumping forward
Fixes #1106
2019-10-09 08:56:48 -07:00
Dan Gohman
ece9450a2f Bump version to 0.45.0 2019-10-09 06:20:30 -07:00
Benjamin Bouvier
cbbd94db02 Allow wrap-around when subtracting type size to immediate in try_fold_extended_move; 2019-10-08 20:16:48 +02:00
Benjamin Bouvier
a9d9f9f135 Write a run test for brz.i128; 2019-10-02 13:43:44 +02:00
Nicolas B. Pierron
e0005f1e6c Insert split-edge of conditional branches before the destination. 2019-10-02 12:03:56 +02:00
bjorn3
093b3b3426 Fix brz.i128
Fixes #1066
2019-10-02 11:04:29 +02:00
Andrew Brown
d8967bb58a Split SIMD arithmetic tests by test directive 2019-09-30 13:54:30 -07:00
Andrew Brown
90c49a2f7c Add saturating subtraction with a SIMD encoding
This includes the new instructions `ssub_sat` and `usub_sat` and only encodes the i8x16 and i16x8 types; these are what is needed for implementing the SIMD spec (see https://github.com/WebAssembly/simd/blob/master/proposals/simd/SIMD.md#saturating-integer-subtraction).
2019-09-30 13:54:30 -07:00
Andrew Brown
21144068d4 Add saturating addition with a SIMD encoding
This includes the new instructions `sadd_sat` and `uadd_sat` and only encodes the i8x16 and i16x8 types; these are what is needed for implementing the SIMD spec (see https://github.com/WebAssembly/simd/blob/master/proposals/simd/SIMD.md#saturating-integer-addition).
2019-09-30 13:54:30 -07:00
Andrew Brown
630cb3ee62 Add x86 encoding for SIMD imul
Only i16x8 and i32x4 are encoded in this commit mainly because i8x16 and i64x2 do not have simple encodings in x86. i64x2 is not required by the SIMD spec and there is discussion (https://github.com/WebAssembly/simd/pull/98#issuecomment-530092217) about removing i8x16.
2019-09-30 13:54:30 -07:00
Andrew Brown
168ad7fda3 Fix 16-bit x86_pextr encoding
The x86 ISA has (at least) two encodings for PEXTRW:
 1. in the SSE2 opcode (66 0f c5) the XMM operand uses r/m and the GPR operand uses reg
 2. in the SSE4.1 opcode (66 0f 3a 15) the XMM operand uses reg and the GPR operand uses r/m

This changes the 16-bit x86_pextr encoding from 1 to 2 to match the other PEXTR* implementations (all #2 style).
2019-09-30 13:54:30 -07:00
Andrew Brown
ba393afd4d Add x86 legalization for SIMD ineg 2019-09-30 13:54:30 -07:00
Andrew Brown
ca1df499a0 Add x86 encoding for isub 2019-09-30 13:54:30 -07:00
Benjamin Bouvier
c3d01756a3 Baldrdash: uses ECX for the WasmTableCallSigReg on x86 32-bits; 2019-09-30 15:11:06 +02:00
Nicolas B. Pierron
40f6d3b753 Set speed-and-size optimization level for legalize-br-table-bb.clif test case. 2019-09-26 12:05:53 +02:00
Ujjwal Sharma
43a891dfa2 [codegen] add intcc conditions for reading overflow flag
Add conditions to IntCC for checking the overflow flag (Overflow,
NotOverflow).
2019-09-25 11:42:58 +02:00
Dan Gohman
dfdd504edc Bump version to 0.44.0 2019-09-24 16:28:17 -07:00
Andrew Brown
a3db30d97e Add x86 encoding for SIMD icmp eq
Also adds a predicate for matching the `eq` IntCC code (TODO this should be replaced by something more general)
2019-09-24 09:33:07 -07:00
Andrew Brown
702155b19b Optimize vconst for x86 when immediate contains all zeroes or ones
Instead of using MOVUPS to expensively load bits from memory, this change uses a predicate to optimize vconst without a memory access:
 - when the 128-bit immediate is all zeroes in all bits, use PXOR to zero out an XMM register
 - when the 128-bit immediate is all ones in all bits, use PCMPEQB to set an XMM register to all ones

This leaves the constant data in the constant pool, which may increase code size (TODO)
2019-09-24 09:33:07 -07:00
Dan Gohman
411545ed9a Bump version to 0.43.1 2019-09-20 14:11:15 -07:00
Dan Gohman
5c5eabb8d0 Bump version to 0.43.0 2019-09-19 12:23:51 -07:00
Andrew Brown
766cf8ddfd Add x86 implemention for SIMD iadd 2019-09-19 12:04:14 -07:00
Andrew Brown
20c67f243e Add boolean shuffle test 2019-09-19 10:53:40 -07:00
Andrew Brown
af1499ce99 Add x86 implementation of shuffle 2019-09-19 10:53:40 -07:00
julian-seward1
9e088e4164 Reorganise optimisation level settings, and make the insn shrink pass optional (#1044)
This patch:

* removes the "default" opt level, on the basis that it has no definition and
  is referred to nowhere in the compiler.

* renames the "fastest" level to "none".  The resulting set of transformations
  is unchanged.

* renames the "best" level to "speed_and_size".  The resulting set of
  transformations is unchanged.

* adds a new level, "speed".  This is the same as "speed_and_size" except that
  it omits transformations aimed only at reducing code size.  Currently it
  omits only the insn shrinking pass.
2019-09-19 18:51:25 +02:00
bjorn3
add6a4f269 Correctly zero extend operand of fcvt_from_uint for 8ints and 16bit ints (#997)
Fixes #996
2019-09-18 10:06:15 +02:00
Andrew Brown
9b852fde09 Add verifier check to ensure each SIMD lane index is within bounds, fixes #1016 2019-09-17 09:29:36 -07:00
Wander Lairson Costa
863ac809d9 [codegen] Check for downcasting in bitcast instruction
Bitcasting to a smaller size is invalid.

closes #854
2019-09-17 17:07:07 +02:00
Andy Wortman
99380fad1a Use 'xor r, r' to set registers to 0 instead of mov (#766) 2019-09-16 16:35:55 +02:00
Ujjwal Sharma
3418fb6e18 [codegen] reintroduce support for carry and borrow instructions in RI… (#1005)
Reintroduce support for iadd carry variants and isub borrow variants for
RISC ISAs which had been removed in
https://github.com/CraneStation/cranelift/pull/961 and
https://github.com/CraneStation/cranelift/pull/962 because of the lack
of a proper flags register in RISC architectures.
2019-09-13 17:27:49 +02:00
Nicolas B. Pierron
e8dc9ad8c9 Fix x86/br-i128 test case to use basic blocks. 2019-09-11 20:24:48 +02:00
Wander Lairson Costa
35c6d869f5 Replace region::protect by make_exec in cranelift-filetests 2019-09-10 18:53:02 -07:00
Benjamin Bouvier
cad2074587 [codegen] Don't simplify an operation if it would result in unnecessary legalization;
Converting something like iadd.i64 on a 32-bits architecture into a
iadd_imm.i64 will result in the instruction being legalized back to an
iadd.i64 later on, creating unnecessary churn.

This commit implements avoid doing so, and changes the target ISA to a
64-bits platform for tests than ran into this, as well as making sure
this won't happen on 32-bits platforms.
2019-09-10 19:50:34 +02:00
Benjamin Bouvier
3aa76b558c Legalize i64.const by breaking it into two i32.const, on 32-bits platforms; 2019-09-10 19:50:34 +02:00
Andrew Brown
6f1ed94e82 Fix documentation 2019-09-10 10:45:12 -07:00
Andrew Brown
295b2ef614 Avoid extra register movement when lowering an x86 insertlane to a float vector 2019-09-10 10:45:12 -07:00
Andrew Brown
3dfc68afb1 Avoid extra register movement when lowering the x86 scalar_to_vector of a float value 2019-09-10 10:45:12 -07:00
Andrew Brown
00bedca274 Avoid extra register movement when lowering the x86 extractlane of a float vector
This commit is based on the assumption that floats are already stored in XMM registers in x86. When extracting a lane, cranelift was moving the float to a regular register and back to an XMM register; this change avoids this by shuffling the float value to the lowest bits of the XMM register. It also assumes that the upper bits can be left as is (instead of zeroing them out).
2019-09-10 10:45:12 -07:00
Andrew Brown
ebc783e49b Use raw_bitcast when legalizing splat
raw_bitcast matches the intent of this legalization more clearly (to simply change the CLIF type without changing any bits) and the additional null encodings added are necessary for later instructions
2019-09-10 10:45:12 -07:00
Nicolas B. Pierron
81fa5e7696 Add equivalent safepoint test cases for basic blocks. 2019-09-10 14:53:13 +02:00
Ujjwal Sharma
345b2dc0cc [codegen] add new recipe "rout" (#1014)
* [codegen] add new recipe "rout"

Add a new recipe "rout" intended to be used by arithematic operations
that output flags, currently being used for `iadd_cout` and `isub_bout`.

Fixes: https://github.com/CraneStation/cranelift/issues/1009
2019-09-10 12:55:24 +02:00
bjorn3
f4cdd3007c [split] Prevent double legalization of isplit and vsplit 2019-09-07 09:55:09 -07:00
bjorn3
2426bce9ac Fix load.i64 and store legalization 2019-09-07 09:55:09 -07:00