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

73 lines
1.8 KiB
Plaintext

; Check that floating-point constants equal to zero are optimized correctly.
test binemit
set opt_level=speed_and_size
target x86_64
function %zero_const_32bit_no_rex() -> f32 fast {
ebb0:
; asm: xorps %xmm0, %xmm0
[-,%xmm0] v0 = f32const 0.0 ; bin: 0f 57 c0
return v0
}
function %zero_const_32bit_rex() -> f32 fast {
ebb0:
; asm: xorps %xmm8, %xmm8
[-,%xmm8] v1 = f32const 0.0 ; bin: 45 0f 57 c0
return v1
}
function %zero_const_64bit_no_rex() -> f64 fast {
ebb0:
; asm: xorpd %xmm0, %xmm0
[-,%xmm0] v0 = f64const 0.0 ; bin: 66 0f 57 c0
return v0
}
function %zero_const_64bit_rex() -> f64 fast {
ebb0:
; asm: xorpd %xmm8, %xmm8
[-,%xmm8] v1 = f64const 0.0 ; bin: 66 45 0f 57 c0
return v1
}
function %imm_zero_register() -> i64 fast {
ebb0:
; asm: xor %eax, %eax
[-,%rax] v0 = iconst.i64 0 ; bin: 31 c0
; asm: xor %edi, %edi
[-,%rdi] v1 = iconst.i64 0 ; bin: 31 ff
; asm: xor %r8, r8
[-,%r8] v2 = iconst.i64 0 ; bin: 45 31 c0
; asm: xor %r15, %r15
[-,%r15] v4 = iconst.i64 0 ; bin: 45 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 %r8b, %r8b
[-,%r15] v0 = iconst.i8 0 ; bin: 45 30 ff
; asm: xor %al, %al
[-,%rax] v1 = iconst.i8 0 ; bin: 30 c0
; asm: xor %dh, %dh
[-,%rdi] v2 = iconst.i8 0 ; bin: 30 ff
return v0
}