122 lines · plain
1# RUN: llc -run-pass x86-fixup-LEAs -mtriple=x86_64-gnu-unknown -verify-machineinstrs -mcpu=corei7-avx -o - %s | FileCheck %s --check-prefixes=COREI7,CHECK2# RUN: llc -run-pass x86-fixup-LEAs -mtriple=x86_64-gnu-unknown -verify-machineinstrs -mcpu=haswell -o - %s | FileCheck %s --check-prefixes=HASWELL,CHECK3# RUN: llc -run-pass x86-fixup-LEAs -mtriple=x86_64-unknown-unknown -verify-machineinstrs -mcpu=atom -o - %s | FileCheck %s --check-prefixes=ATOM,CHECK4#5# Test several LEA <=> ADD transformations that the fixup-leas pass performs,6# and check that any debug-instr-number attached to the original instruction7# is substituted onto the new instruction.8# Some are only reachable under specific CPU modes it seems -- each function9# in this file is only tested by one prefix / CPU mode. Some i386 specific10# behaviours are in the -2 flavour of this file.11---12# COREI7-LABEL: name: pr4375813name: pr4375814alignment: 1615tracksRegLiveness: true16debugInstrRef: true17liveins:18 - { reg: '$rax' }19 - { reg: '$rbp' }20# COREI7: debugValueSubstitutions:21# COREI7-NEXT: - { srcinst: 1, srcop: 0, dstinst: 2, dstop: 0, subreg: 0 }22body: |23 bb.0:24 liveins: $rax, $rbp25 26 $ebp = LEA64_32r killed $rbp, 1, killed $rax, 0, $noreg, debug-instr-number 127 ; COREI7: ADD32rr {{.*}} debug-instr-number 228 RET64 $ebp29 30...31---32name: test_mul_spec33# HASWELL-LABEL: name: test_mul_spec34alignment: 1635tracksRegLiveness: true36debugInstrRef: true37liveins:38 - { reg: '$edi' }39frameInfo:40 maxAlignment: 141 maxCallFrameSize: 042machineFunctionInfo: {}43# HASWELL: debugValueSubstitutions:44# HASWELL-NEXT: - { srcinst: 1, srcop: 0, dstinst: 3, dstop: 0, subreg: 0 }45# HASWELL-NEXT: - { srcinst: 2, srcop: 0, dstinst: 4, dstop: 0, subreg: 0 }46body: |47 bb.0:48 liveins: $edi49 50 renamable $edi = KILL $edi, implicit-def $rdi51 renamable $ecx = nsw LEA64_32r renamable $rdi, 8, renamable $rdi, 42, $noreg, debug-instr-number 152 ; HASWELL: ADD32ri {{.*}} debug-instr-number 353 renamable $eax = nsw LEA64_32r killed renamable $rdi, 4, renamable $rdi, 2, $noreg, debug-instr-number 254 ; HASWELL: ADD32ri {{.*}} debug-instr-number 455 renamable $eax = nsw IMUL32rr killed renamable $eax, killed renamable $ecx, implicit-def dead $eflags56 RET64 $eax57 58...59---60name: testthree61# ATOM-LABEL: name: testthree62alignment: 1663tracksRegLiveness: true64debugInstrRef: true65frameInfo:66 maxAlignment: 167 maxCallFrameSize: 068machineFunctionInfo: {}69# ATOM: debugValueSubstitutions:70# ATOM-NEXT: - { srcinst: 1, srcop: 0, dstinst: 2, dstop: 0, subreg: 0 }71body: |72 bb.0.entry:73 renamable $ecx = MOV32ri 074 renamable $eax = XOR32rr undef $eax, undef $eax, implicit-def dead $eflags75 renamable $ecx = nsw ADD32rr renamable $ecx, renamable $eax, implicit-def dead $eflags, implicit killed $rax, implicit killed $rcx, implicit-def $rcx, debug-instr-number 176 ; ATOM: LEA64_32r {{.*}} debug-instr-number 277 renamable $eax = MOV32rm killed renamable $rcx, 1, $noreg, 0, $noreg :: (load (s32) from `ptr undef`)78 RET64 $eax79 80...81---82# CHECK-LABEL: testfour83# In this code sequence, an LEA is converted into a subtract that's combined84# with another subtract. The instruction number on the computed value should85# only be attached to the last subtract.86name: testfour87alignment: 1688tracksRegLiveness: true89tracksDebugUserValues: true90debugInstrRef: true91liveins:92 - { reg: '$esi' }93frameInfo:94 maxAlignment: 195 maxCallFrameSize: 096machineFunctionInfo: {}97# CHECK: debugValueSubstitutions:98# CHECK-NEXT: - { srcinst: 1, srcop: 0, dstinst: 2, dstop: 0, subreg: 0 }99# CHECK-NEXT: constants:100body: |101 bb.0.entry:102 liveins: $esi103 104 $eax = MOV32rr $esi, implicit-def $rax105 106 renamable $ecx = LEA64_32r renamable $rax, 1, renamable $rax, 0, $noreg107 renamable $edx = MOV32ri 1108 renamable $edx = SUB32rr killed renamable $edx, killed renamable $ecx, implicit-def dead $eflags, debug-instr-number 1109 110 ; CHECK: MOV32ri 1111 ; CHECK-NOT: debug-instr-number112 ; CHECK-NEXT: SUB32rr113 ; CHECK-NOT: debug-instr-number114 ; CHECK-NEXT: SUB32rr115 ; CHECK-SAME: debug-instr-number 2116 117 MOV32mr $noreg, 1, $noreg, 0, $noreg, killed renamable $edx118 $eax = KILL renamable $eax, implicit killed $rax119 RET64 $eax120 121...122