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.
41 lines
1.1 KiB
Plaintext
41 lines
1.1 KiB
Plaintext
test binemit
|
|
set opt_level=speed_and_size
|
|
target x86_64
|
|
|
|
; Test that instruction shrinking eliminates REX prefixes when possible.
|
|
|
|
; The binary encodings can be verified with the command:
|
|
;
|
|
; sed -ne 's/^ *; asm: *//p' filetests/isa/x86/shrink.clif | llvm-mc -show-encoding -triple=x86_64
|
|
;
|
|
|
|
function %test_shrinking(i32) -> i32 {
|
|
ebb0(v0: i32 [ %rdi ]):
|
|
; asm: movl $0x2,%eax
|
|
[-,%rcx] v1 = iconst.i32 2 ; bin: b9 00000002
|
|
; asm: subl %ecx,%edi
|
|
[-,%rdi] v2 = isub v0, v1 ; bin: 29 cf
|
|
return v2
|
|
}
|
|
|
|
function %test_not_shrinking(i32) -> i32 {
|
|
ebb0(v0: i32 [ %r8 ]):
|
|
; asm: movl $0x2,%eax
|
|
[-,%rcx] v1 = iconst.i32 2 ; bin: b9 00000002
|
|
; asm: subl %ecx,%edi
|
|
[-,%r8] v2 = isub v0, v1 ; bin: 41 29 c8
|
|
return v2
|
|
}
|
|
|
|
function %test_not_shrinking_i8() {
|
|
ebb0:
|
|
[-,%rsi] v1 = iconst.i8 1
|
|
; asm: movsbl %sil,%esi
|
|
[-,%rsi] v2 = sextend.i32 v1 ; bin: 40 0f be f6
|
|
; asm: movzbl %sil,%esi
|
|
[-,%rsi] v3 = uextend.i32 v1 ; bin: 40 0f b6 f6
|
|
; asm: movzbl %sil,%esi
|
|
[-,%rsi] v4 = uextend.i64 v1 ; bin: 40 0f b6 f6
|
|
trap user0
|
|
}
|