1 # RUN: llc -run-pass x86-fixup-LEAs -mtriple=x86_64-gnu-unknown -verify-machineinstrs -mcpu=corei7-avx -o - %s | FileCheck %s --check-prefix=COREI7
2 # RUN: llc -run-pass x86-fixup-LEAs -mtriple=x86_64-gnu-unknown -verify-machineinstrs -mcpu=haswell -o - %s | FileCheck %s --check-prefix=HASWELL
3 # RUN: llc -run-pass x86-fixup-LEAs -mtriple=x86_64-unknown-unknown -verify-machineinstrs -mcpu=atom -o - %s | FileCheck %s --check-prefix=ATOM
5 # Test several LEA <=> ADD transformations that the fixup-leas pass performs,
6 # and check that any debug-instr-number attached to the original instruction
7 # is substituted onto the new instruction.
8 # Some are only reachable under specific CPU modes it seems -- each function
9 # in this file is only tested by one prefix / CPU mode. Some i386 specific
10 # behaviours are in the -2 flavour of this file.
12 # COREI7-LABE: name: pr43758
15 tracksRegLiveness: true
19 # COREI7: debugValueSubstitutions:
20 # COREI7-NEXT: - { srcinst: 1, srcop: 0, dstinst: 2, dstop: 0, subreg: 0 }
25 $ebp = LEA64_32r killed $rbp, 1, killed $rax, 0, $noreg, debug-instr-number 1
26 ; COREI7: ADD32rr {{.*}} debug-instr-number 2
32 # HASWELL-LABEL: name: test_mul_spec
34 tracksRegLiveness: true
40 machineFunctionInfo: {}
41 # HASWELL: debugValueSubstitutions:
42 # HASWELL-NEXT: - { srcinst: 1, srcop: 0, dstinst: 3, dstop: 0, subreg: 0 }
43 # HASWELL-NEXT: - { srcinst: 2, srcop: 0, dstinst: 4, dstop: 0, subreg: 0 }
48 renamable $edi = KILL $edi, implicit-def $rdi
49 renamable $ecx = nsw LEA64_32r renamable $rdi, 8, renamable $rdi, 42, $noreg, debug-instr-number 1
50 ; HASWELL: ADD32ri8 {{.*}} debug-instr-number 3
51 renamable $eax = nsw LEA64_32r killed renamable $rdi, 4, renamable $rdi, 2, $noreg, debug-instr-number 2
52 ; HASWELL: ADD32ri8 {{.*}} debug-instr-number 4
53 renamable $eax = nsw IMUL32rr killed renamable $eax, killed renamable $ecx, implicit-def dead $eflags
59 # ATOM-LABEL: name: testthree
61 tracksRegLiveness: true
65 machineFunctionInfo: {}
66 # ATOM: debugValueSubstitutions:
67 # ATOM-NEXT: - { srcinst: 1, srcop: 0, dstinst: 2, dstop: 0, subreg: 0 }
70 renamable $ecx = MOV32ri 0
71 renamable $eax = XOR32rr undef $eax, undef $eax, implicit-def dead $eflags
72 renamable $ecx = nsw ADD32rr renamable $ecx, renamable $eax, implicit-def dead $eflags, implicit killed $rax, implicit killed $rcx, implicit-def $rcx, debug-instr-number 1
73 ; ATOM: LEA64_32r {{.*}} debug-instr-number 2
74 renamable $eax = MOV32rm killed renamable $rcx, 1, $noreg, 0, $noreg :: (load (s32) from `i32 *undef`)