blob: 653bd2b58da17893117719e2cea38adff47932d3 [file] [edit]
# NOTE: Assertions have been autogenerated by utils/update_mir_test_checks.py UTC_ARGS: --version 3
# RUN: llc -mtriple=x86_64-unknown-linux-gnu -mattr=slow-3ops-lea -run-pass x86-fixup-leas -o - %s | FileCheck %s
# When splitting a slow 3-operand LEA, a displacement of exactly 128 should
# become SUB of -128 rather than ADD of 128: only -128 fits the sign-extended
# 8-bit immediate, saving three bytes. Adjacent displacements keep the ADD.
--- |
define void @disp128() nounwind {
ret void
}
define void @disp128_32() nounwind {
ret void
}
define void @disp129() nounwind {
ret void
}
define void @disp_minus128() nounwind {
ret void
}
---
name: disp128
body: |
bb.0:
; CHECK-LABEL: name: disp128
; CHECK: renamable $rax = LEA64r renamable $rdi, 1, renamable $rsi, 0, $noreg
; CHECK-NEXT: $rax = SUB64ri32 $rax, -128, implicit-def $eflags
; CHECK-NEXT: JMP64r renamable $rax
renamable $rax = LEA64r renamable $rdi, 1, renamable $rsi, 128, $noreg
JMP64r renamable $rax
...
---
name: disp128_32
body: |
bb.0:
; CHECK-LABEL: name: disp128_32
; CHECK: renamable $eax = LEA64_32r renamable $rdi, 1, renamable $rsi, 0, $noreg
; CHECK-NEXT: $eax = SUB32ri $eax, -128, implicit-def $eflags
; CHECK-NEXT: RET64 implicit $eax
renamable $eax = LEA64_32r renamable $rdi, 1, renamable $rsi, 128, $noreg
RET64 implicit $eax
...
---
name: disp129
body: |
bb.0:
; CHECK-LABEL: name: disp129
; CHECK: renamable $rax = LEA64r renamable $rdi, 1, renamable $rsi, 0, $noreg
; CHECK-NEXT: $rax = ADD64ri32 $rax, 129, implicit-def $eflags
; CHECK-NEXT: JMP64r renamable $rax
renamable $rax = LEA64r renamable $rdi, 1, renamable $rsi, 129, $noreg
JMP64r renamable $rax
...
---
name: disp_minus128
body: |
bb.0:
; CHECK-LABEL: name: disp_minus128
; CHECK: renamable $rax = LEA64r renamable $rdi, 1, renamable $rsi, 0, $noreg
; CHECK-NEXT: $rax = ADD64ri32 $rax, -128, implicit-def $eflags
; CHECK-NEXT: JMP64r renamable $rax
renamable $rax = LEA64r renamable $rdi, 1, renamable $rsi, -128, $noreg
JMP64r renamable $rax
...