323 lines · plain
1# RUN: llc -mattr=+egpr,+ndd -x mir < %s -x86-enable-apx-for-relocation=true -run-pass x86-suppress-apx-for-relocation -verify-machineinstrs -o - | FileCheck %s --check-prefixes=CHECK,APXREL2# RUN: llc -mattr=+egpr,+ndd -x mir < %s -run-pass x86-suppress-apx-for-relocation -verify-machineinstrs -o - | FileCheck %s --check-prefixes=CHECK,NOAPXREL3 4 5--- |6 target triple = "x86_64-unknown-linux-gnu"7 8 @x = external global i649 @i = external thread_local global i3210 11 define i32 @mov() {12 entry:13 ret i32 undef14 }15 16 define i8 @test() {17 entry:18 ret i8 undef19 }20 define i32 @adc() {21 entry:22 ret i32 undef23 }24 25 define i32 @add() {26 entry:27 ret i32 undef28 }29 30 define i32 @and() {31 entry:32 ret i32 undef33 }34 35 define i8 @cmp() {36 entry:37 ret i8 undef38 }39 40 define i32 @or() {41 entry:42 ret i32 undef43 }44 45 define i32 @sbb() {46 entry:47 ret i32 undef48 }49 50 define i32 @sub() {51 entry:52 ret i32 undef53 }54 55 define i32 @xor() {56 entry:57 ret i32 undef58 }59 60 define i32 @add64rm_nd_gotpcrel() {61 entry:62 ret i32 undef63 }64 65 define i32 @add64rm_nd_gottpoff() {66 entry:67 ret i32 undef68 }69 70 define i32 @add64mr_nd() {71 entry:72 ret i32 undef73 }74...75---76name: mov77alignment: 1678tracksRegLiveness: true79registers:80 - { id: 0, class: gr64 }81 - { id: 1, class: gr32 }82body: |83 bb.0.entry:84 %0:gr64 = MOV64rm $rip, 1, $noreg, target-flags(x86-gottpoff) @i, $noreg :: (load (s64))85 %1:gr32 = MOV32rm killed %0, 1, $noreg, 0, $fs :: (load (s32))86 $eax = COPY %187 RET 0, $eax88 89# CHECK: name: mov90# APXREL: %0:gr64 = MOV64rm $rip, 1, $noreg, target-flags(x86-gottpoff) @i, $noreg :: (load (s64))91# NOAPXREL: %0:gr64_norex2 = MOV64rm $rip, 1, $noreg, target-flags(x86-gottpoff) @i, $noreg :: (load (s64))92...93---94name: test95alignment: 1696tracksRegLiveness: true97registers:98 - { id: 0, class: gr64 }99 - { id: 1, class: gr8 }100body: |101 bb.0.entry:102 %0:gr64 = MOV64rm $rip, 1, $noreg, @x, $noreg :: (load (s64))103 TEST64mr $rip, 1, $noreg, target-flags(x86-gottpoff) @i, $noreg, %0:gr64, implicit-def $eflags :: (load (s64))104 %1:gr8 = SETCCr 5, implicit $eflags105 $al = COPY %1106 RET 0, $al107 108# CHECK: name: test109# APXREL: %0:gr64 = MOV64rm $rip, 1, $noreg, @x, $noreg :: (load (s64))110# APXREL-NEXT: TEST64mr $rip, 1, $noreg, target-flags(x86-gottpoff) @i, $noreg, %0, implicit-def $eflags :: (load (s64))111# NOAPXREL: %0:gr64_norex2 = MOV64rm $rip, 1, $noreg, @x, $noreg :: (load (s64))112# NOAPXREL-NEXT: TEST64mr $rip, 1, $noreg, target-flags(x86-gottpoff) @i, $noreg, %0, implicit-def $eflags :: (load (s64))113 114...115---116name: adc117alignment: 16118tracksRegLiveness: true119registers:120 - { id: 0, class: gr64 }121 - { id: 1, class: gr64 }122 - { id: 2, class: gr64 }123 - { id: 3, class: gr32 }124body: |125 bb.0.entry:126 %0:gr64 = MOV64rm $rip, 1, $noreg, @x, $noreg :: (load (s64))127 %1:gr64 = OR64ri8 %0, 7, implicit-def $eflags128 %2:gr64 = ADC64rm %1, $rip, 1, $noreg, target-flags(x86-gottpoff) @i, $noreg, implicit-def $eflags, implicit $eflags :: (load (s64))129 %3:gr32 = MOV32rm killed %2, 1, $noreg, 0, $fs :: (load (s32))130 $eax = COPY %3131 RET 0, $eax132 133# CHECK: name: adc134# APXREL: %2:gr64 = ADC64rm %1, $rip, 1, $noreg, target-flags(x86-gottpoff) @i, $noreg, implicit-def $eflags, implicit $eflags :: (load (s64))135# NOAPXREL: %2:gr64_norex2 = ADC64rm %1, $rip, 1, $noreg, target-flags(x86-gottpoff) @i, $noreg, implicit-def $eflags, implicit $eflags :: (load (s64))136...137---138name: add139alignment: 16140tracksRegLiveness: true141registers:142 - { id: 0, class: gr64 }143 - { id: 1, class: gr64 }144 - { id: 2, class: gr32 }145body: |146 bb.0.entry:147 %0:gr64 = MOV64rm $rip, 1, $noreg, @x, $noreg :: (load (s64))148 %1:gr64 = ADD64rm %0, $rip, 1, $noreg, target-flags(x86-gottpoff) @i, $noreg, implicit-def $eflags :: (load (s64))149 %2:gr32 = MOV32rm killed %1, 1, $noreg, 0, $fs :: (load (s32))150 $eax = COPY %2151 RET 0, $eax152# CHECK: name: add153# APXREL: %1:gr64 = ADD64rm %0, $rip, 1, $noreg, target-flags(x86-gottpoff) @i, $noreg, implicit-def $eflags :: (load (s64))154# NOAPXREL: %1:gr64_norex2 = ADD64rm %0, $rip, 1, $noreg, target-flags(x86-gottpoff) @i, $noreg, implicit-def $eflags :: (load (s64))155...156---157name: and158alignment: 16159tracksRegLiveness: true160registers:161 - { id: 0, class: gr64 }162 - { id: 1, class: gr64 }163 - { id: 2, class: gr32 }164body: |165 bb.0.entry:166 %0:gr64 = MOV64rm $rip, 1, $noreg, @x, $noreg :: (load (s64))167 %1:gr64 = AND64rm %0, $rip, 1, $noreg, target-flags(x86-gottpoff) @i, $noreg, implicit-def $eflags :: (load (s64))168 %2:gr32 = MOV32rm killed %1, 1, $noreg, 0, $fs :: (load (s32))169 $eax = COPY %2170 RET 0, $eax171 172# CHECK: name: and173# APXREL: %1:gr64 = AND64rm %0, $rip, 1, $noreg, target-flags(x86-gottpoff) @i, $noreg, implicit-def $eflags :: (load (s64))174# NOAPXREL: %1:gr64_norex2 = AND64rm %0, $rip, 1, $noreg, target-flags(x86-gottpoff) @i, $noreg, implicit-def $eflags :: (load (s64))175...176---177name: or178alignment: 16179tracksRegLiveness: true180registers:181 - { id: 0, class: gr64 }182 - { id: 1, class: gr64 }183 - { id: 2, class: gr32 }184body: |185 bb.0.entry:186 %0:gr64 = MOV64rm $rip, 1, $noreg, @x, $noreg :: (load (s64))187 %1:gr64 = OR64rm %0, $rip, 1, $noreg, target-flags(x86-gottpoff) @i, $noreg, implicit-def $eflags :: (load (s64))188 %2:gr32 = MOV32rm killed %1, 1, $noreg, 0, $fs :: (load (s32))189 $eax = COPY %2190 RET 0, $eax191 192# CHECK: name: or193# APXREL: %1:gr64 = OR64rm %0, $rip, 1, $noreg, target-flags(x86-gottpoff) @i, $noreg, implicit-def $eflags :: (load (s64))194# NOAPXREL: %1:gr64_norex2 = OR64rm %0, $rip, 1, $noreg, target-flags(x86-gottpoff) @i, $noreg, implicit-def $eflags :: (load (s64))195...196---197name: sbb198alignment: 16199tracksRegLiveness: true200registers:201 - { id: 0, class: gr64 }202 - { id: 1, class: gr64 }203 - { id: 2, class: gr64 }204 - { id: 3, class: gr32 }205body: |206 bb.0.entry:207 %0:gr64 = MOV64rm $rip, 1, $noreg, @x, $noreg :: (load (s64))208 %1:gr64 = OR64ri8 %0, 7, implicit-def $eflags209 %2:gr64 = SBB64rm %1, $rip, 1, $noreg, target-flags(x86-gottpoff) @i, $noreg, implicit-def $eflags, implicit $eflags :: (load (s64))210 %3:gr32 = MOV32rm killed %2, 1, $noreg, 0, $fs :: (load (s32))211 $eax = COPY %3212 RET 0, $eax213 214# CHECK: name: sbb215# APXREL: %1:gr64 = OR64ri8 %0, 7, implicit-def $eflags216# APXREL-NEXT: %2:gr64 = SBB64rm %1, $rip, 1, $noreg, target-flags(x86-gottpoff) @i, $noreg, implicit-def $eflags, implicit $eflags :: (load (s64))217# NOAPXREL: %1:gr64_norex2 = OR64ri8 %0, 7, implicit-def $eflags218# NOAPXREL-NEXT: %2:gr64_norex2 = SBB64rm %1, $rip, 1, $noreg, target-flags(x86-gottpoff) @i, $noreg, implicit-def $eflags, implicit $eflags :: (load (s64))219...220---221name: sub222alignment: 16223tracksRegLiveness: true224registers:225 - { id: 0, class: gr64 }226 - { id: 1, class: gr64 }227 - { id: 2, class: gr32 }228body: |229 bb.0.entry:230 %0:gr64 = MOV64rm $rip, 1, $noreg, @x, $noreg :: (load (s64))231 %1:gr64 = SUB64rm %0, $rip, 1, $noreg, target-flags(x86-gottpoff) @i, $noreg, implicit-def $eflags :: (load (s64))232 %2:gr32 = MOV32rm killed %1, 1, $noreg, 0, $fs :: (load (s32))233 $eax = COPY %2234 RET 0, $eax235 236# CHECK: name: sub237# APXREL: %1:gr64 = SUB64rm %0, $rip, 1, $noreg, target-flags(x86-gottpoff) @i, $noreg, implicit-def $eflags :: (load (s64))238# NOAPXREL: %1:gr64_norex2 = SUB64rm %0, $rip, 1, $noreg, target-flags(x86-gottpoff) @i, $noreg, implicit-def $eflags :: (load (s64))239...240---241name: xor242alignment: 16243tracksRegLiveness: true244registers:245 - { id: 0, class: gr64 }246 - { id: 1, class: gr64 }247 - { id: 2, class: gr32 }248body: |249 bb.0.entry:250 %0:gr64 = MOV64rm $rip, 1, $noreg, @x, $noreg :: (load (s64))251 %1:gr64 = XOR64rm %0, $rip, 1, $noreg, target-flags(x86-gottpoff) @i, $noreg, implicit-def $eflags :: (load (s64))252 %2:gr32 = MOV32rm killed %1, 1, $noreg, 0, $fs :: (load (s32))253 $eax = COPY %2254 RET 0, $eax255 256# CHECK: name: xor257# APXREL: %1:gr64 = XOR64rm %0, $rip, 1, $noreg, target-flags(x86-gottpoff) @i, $noreg, implicit-def $eflags :: (load (s64))258# NOAPXREL: %1:gr64_norex2 = XOR64rm %0, $rip, 1, $noreg, target-flags(x86-gottpoff) @i, $noreg, implicit-def $eflags :: (load (s64))259...260---261name: add64rm_nd_gotpcrel262alignment: 16263tracksRegLiveness: true264registers:265 - { id: 0, class: gr64 }266 - { id: 1, class: gr64 }267 - { id: 2, class: gr32 }268body: |269 bb.0.entry:270 %0:gr64 = MOV64rm $rip, 1, $noreg, @x, $noreg :: (load (s64))271 %1:gr64 = ADD64rm_ND %0, $rip, 1, $noreg, target-flags(x86-gotpcrel) @i, $noreg, implicit-def dead $eflags :: (load (s64) from got)272 %2:gr32 = MOV32rm killed %1, 1, $noreg, 0, $fs :: (load (s32))273 $eax = COPY %2274 RET 0, $eax275 276# CHECK: name: add64rm_nd_gotpcrel277# APXREL: %1:gr64 = ADD64rm_ND %0, $rip, 1, $noreg, target-flags(x86-gotpcrel) @i, $noreg, implicit-def dead $eflags :: (load (s64) from got)278# NOAPXREL: %3:gr64_norex2 = COPY %0279# NOAPXREL: %1:gr64_norex2 = ADD64rm %3, $rip, 1, $noreg, target-flags(x86-gotpcrel) @i, $noreg, implicit-def dead $eflags280...281---282name: add64rm_nd_gottpoff283alignment: 16284tracksRegLiveness: true285registers:286 - { id: 0, class: gr64 }287 - { id: 1, class: gr64 }288 - { id: 2, class: gr32 }289body: |290 bb.0.entry:291 %0:gr64 = MOV64rm $rip, 1, $noreg, @x, $noreg :: (load (s64))292 %1:gr64 = ADD64rm_ND %0, $rip, 1, $noreg, target-flags(x86-gottpoff) @i, $noreg, implicit-def dead $eflags :: (load (s64) from got)293 %2:gr32 = MOV32rm killed %1, 1, $noreg, 0, $fs :: (load (s32))294 $eax = COPY %2295 RET 0, $eax296 297# CHECK: name: add64rm_nd298# APXREL: %1:gr64 = ADD64rm_ND %0, $rip, 1, $noreg, target-flags(x86-gottpoff) @i, $noreg, implicit-def dead $eflags :: (load (s64) from got)299# NOAPXREL: %3:gr64_norex2 = COPY %0300# NOAPXREL: %1:gr64_norex2 = ADD64rm %3, $rip, 1, $noreg, target-flags(x86-gottpoff) @i, $noreg, implicit-def dead $eflags301...302---303name: add64mr_nd304alignment: 16305tracksRegLiveness: true306registers:307 - { id: 0, class: gr64 }308 - { id: 1, class: gr64 }309 - { id: 2, class: gr32 }310body: |311 bb.0.entry:312 %0:gr64 = MOV64rm $rip, 1, $noreg, @x, $noreg :: (load (s64))313 %1:gr64 = ADD64mr_ND $rip, 1, $noreg, target-flags(x86-gottpoff) @i, $noreg, %0, implicit-def dead $eflags :: (load (s64) from got)314 %2:gr32 = MOV32rm killed %1, 1, $noreg, 0, $fs :: (load (s32))315 $eax = COPY %2316 RET 0, $eax317 318# CHECK: name: add64mr_nd319# APXREL: %1:gr64 = ADD64mr_ND $rip, 1, $noreg, target-flags(x86-gottpoff) @i, $noreg, %0, implicit-def dead $eflags :: (load (s64) from got)320# NOAPXREL: %3:gr64_norex2 = COPY %0321# NOAPXREL: %1:gr64_norex2 = ADD64rm %3, $rip, 1, $noreg, target-flags(x86-gottpoff) @i, $noreg, implicit-def dead $eflags322...323