Files
wasmtime/cranelift/filetests/filetests/isa/x86/optimized-zero-constants-32bit.clif
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

53 lines
1.3 KiB
Plaintext

; Check that floating-point and integer constants equal to zero are optimized correctly.
test binemit
set opt_level=speed_and_size
target i686
function %foo() -> f32 fast {
ebb0:
; asm: xorps %xmm0, %xmm0
[-,%xmm0] v0 = f32const 0.0 ; bin: 0f 57 c0
return v0
}
function %bar() -> f64 fast {
ebb0:
; asm: xorpd %xmm0, %xmm0
[-,%xmm0] v1 = f64const 0.0 ; bin: 66 0f 57 c0
return v1
}
function %zero_dword() -> i32 fast {
ebb0:
; asm: xor %eax, %eax
[-,%rax] v0 = iconst.i32 0 ; bin: 31 c0
; asm: xor %edi, %edi
[-,%rdi] v1 = iconst.i32 0 ; bin: 31 ff
return v0
}
function %zero_word() -> i16 fast {
ebb0:
; while you may expect this to be encoded like 6631c0, aka
; xor %ax, %ax, the upper 16 bits of the register used for
; i16 are left undefined, so it's not wrong to clear them.
;
; discarding the 66 prefix is shorter, so this test expects
; that we do so.
;
; asm: xor %eax, %eax
[-,%rax] v0 = iconst.i16 0 ; bin: 31 c0
; asm: xor %edi, %edi
[-,%rdi] v1 = iconst.i16 0 ; bin: 31 ff
return v0
}
function %zero_byte() -> i8 fast {
ebb0:
; asm: xor %al, %al
[-,%rax] v0 = iconst.i8 0 ; bin: 30 c0
; asm: xor %dh, %dh
[-,%rdi] v1 = iconst.i8 0 ; bin: 30 ff
return v0
}