# RUN: llc -march=mips64 -target-abi n64 -start-before=finalize-isel \ # RUN: -stop-after=finalize-isel -relocation-model=pic -mattr=+xgot \ # RUN: -o /dev/null %s # A simple test to show that we can parse the target specific flags: gpoff-hi, # gpoff-lo, tlsgd, tlsldm, dtprel-hi, dtprel-lo, got-hi, got-lo, call-hi, # call-lo. --- | @v = global i32 0, align 4 @k = thread_local global i32 0, align 4 @j = external thread_local global i32, align 4 @__tls_guard = internal thread_local global i1 false, align 1 declare extern_weak void @_ZTH1j() declare i32 @_Z1gi(i32 signext) define i32 @_Z2k1i(i32 signext %asd) { entry: %call = tail call i32 @_Z1gi(i32 signext %asd) %add = add nsw i32 %call, %asd %0 = load i32, i32* @v, align 4 %add1 = add nsw i32 %add, %0 %.b.i.i = load i1, i1* @__tls_guard, align 1 br i1 %.b.i.i, label %entry._ZTW1k.exit_crit_edge, label %init.i.i entry._ZTW1k.exit_crit_edge: %.pre = load i32, i32* @k, align 4 br label %_ZTW1k.exit init.i.i: store i1 true, i1* @__tls_guard, align 1 %call.i.i.i = tail call i32 @_Z1gi(i32 signext 3) store i32 %call.i.i.i, i32* @k, align 4 br label %_ZTW1k.exit _ZTW1k.exit: %1 = phi i32 [ %.pre, %entry._ZTW1k.exit_crit_edge ], [ %call.i.i.i, %init.i.i ] %add2 = add nsw i32 %add1, %1 br i1 icmp ne (void ()* @_ZTH1j, void ()* null), label %2, label %_ZTW1j.exit ; <label>:2: tail call void @_ZTH1j() br label %_ZTW1j.exit _ZTW1j.exit: %3 = load i32, i32* @j, align 4 %add3 = add nsw i32 %add2, %3 ret i32 %add3 } ... --- name: _Z2k1i alignment: 8 exposesReturnsTwice: false legalized: false regBankSelected: false selected: false tracksRegLiveness: true registers: - { id: 0, class: gpr32, preferred-register: '' } - { id: 1, class: gpr32, preferred-register: '' } - { id: 2, class: gpr32, preferred-register: '' } - { id: 3, class: gpr32, preferred-register: '' } - { id: 4, class: gpr32, preferred-register: '' } - { id: 5, class: gpr64, preferred-register: '' } - { id: 6, class: gpr64, preferred-register: '' } - { id: 7, class: gpr64, preferred-register: '' } - { id: 8, class: gpr64, preferred-register: '' } - { id: 9, class: gpr64, preferred-register: '' } - { id: 10, class: gpr32, preferred-register: '' } - { id: 11, class: gpr32, preferred-register: '' } - { id: 12, class: gpr32, preferred-register: '' } - { id: 13, class: gpr64, preferred-register: '' } - { id: 14, class: gpr64, preferred-register: '' } - { id: 15, class: gpr64, preferred-register: '' } - { id: 16, class: gpr32, preferred-register: '' } - { id: 17, class: gpr64, preferred-register: '' } - { id: 18, class: gpr64, preferred-register: '' } - { id: 19, class: gpr64, preferred-register: '' } - { id: 20, class: gpr64, preferred-register: '' } - { id: 21, class: gpr64, preferred-register: '' } - { id: 22, class: gpr64, preferred-register: '' } - { id: 23, class: gpr32, preferred-register: '' } - { id: 24, class: gpr64, preferred-register: '' } - { id: 25, class: gpr64, preferred-register: '' } - { id: 26, class: gpr64, preferred-register: '' } - { id: 27, class: gpr64, preferred-register: '' } - { id: 28, class: gpr64, preferred-register: '' } - { id: 29, class: gpr64, preferred-register: '' } - { id: 30, class: gpr32, preferred-register: '' } - { id: 31, class: gpr64, preferred-register: '' } - { id: 32, class: gpr64, preferred-register: '' } - { id: 33, class: gpr64, preferred-register: '' } - { id: 34, class: gpr64, preferred-register: '' } - { id: 35, class: gpr32, preferred-register: '' } - { id: 36, class: gpr64, preferred-register: '' } - { id: 37, class: gpr64, preferred-register: '' } - { id: 38, class: gpr64, preferred-register: '' } - { id: 39, class: gpr64, preferred-register: '' } - { id: 40, class: gpr64, preferred-register: '' } - { id: 41, class: gpr64, preferred-register: '' } - { id: 42, class: gpr64, preferred-register: '' } - { id: 43, class: gpr64, preferred-register: '' } - { id: 44, class: gpr64, preferred-register: '' } - { id: 45, class: gpr64, preferred-register: '' } - { id: 46, class: gpr64, preferred-register: '' } - { id: 47, class: gpr64, preferred-register: '' } - { id: 48, class: gpr64, preferred-register: '' } - { id: 49, class: gpr64, preferred-register: '' } - { id: 50, class: gpr64, preferred-register: '' } - { id: 51, class: gpr64, preferred-register: '' } - { id: 52, class: gpr64, preferred-register: '' } - { id: 53, class: gpr64, preferred-register: '' } - { id: 54, class: gpr64, preferred-register: '' } - { id: 55, class: gpr32, preferred-register: '' } - { id: 56, class: gpr32, preferred-register: '' } - { id: 57, class: gpr64, preferred-register: '' } - { id: 58, class: gpr64, preferred-register: '' } liveins: - { reg: '$a0_64', virtual-reg: '%5' } - { reg: '$t9_64', virtual-reg: '' } frameInfo: isFrameAddressTaken: false isReturnAddressTaken: false hasStackMap: false hasPatchPoint: false stackSize: 0 offsetAdjustment: 0 maxAlignment: 1 adjustsStack: false hasCalls: true stackProtector: '' maxCallFrameSize: 4294967295 hasOpaqueSPAdjustment: false hasVAStart: false hasMustTailInVarArgFunc: false savePoint: '' restorePoint: '' fixedStack: stack: constants: body: | bb.0.entry: successors: %bb.1.entry._ZTW1k.exit_crit_edge(0x7fe00000), %bb.2.init.i.i(0x00200000) liveins: $a0_64, $t9_64 %57 = LUi64 target-flags(mips-gpoff-hi) @_Z2k1i %58 = DADDu %57, $t9_64 %6 = DADDiu %58, target-flags(mips-gpoff-lo) @_Z2k1i %5 = COPY $a0_64 ADJCALLSTACKDOWN 0, 0, implicit-def dead $sp, implicit $sp %7 = LUi64 target-flags(mips-call-hi16) @_Z1gi %8 = DADDu killed %7, %6 %9 = LD killed %8, target-flags(mips-call-lo16) @_Z1gi :: (load (s64) from call-entry @_Z1gi) $a0_64 = COPY %5 $gp_64 = COPY %6 JALR64Pseudo killed %9, csr_n64, implicit-def dead $ra, implicit $a0_64, implicit $gp_64, implicit-def $sp, implicit-def $v0 ADJCALLSTACKUP 0, 0, implicit-def dead $sp, implicit $sp %10 = COPY $v0 %11 = COPY %5.sub_32 %12 = ADDu %10, killed %11 %13 = LUi64 target-flags(mips-got-hi16) @v %14 = DADDu killed %13, %6 %15 = LD killed %14, target-flags(mips-got-lo16) @v :: (load (s64) from got) %16 = LW killed %15, 0 :: (dereferenceable load (s32) from @v) %0 = ADDu killed %12, killed %16 ADJCALLSTACKDOWN 0, 0, implicit-def dead $sp, implicit $sp %17 = LUi64 target-flags(mips-call-hi16) &__tls_get_addr %18 = DADDu killed %17, %6 %19 = LD killed %18, target-flags(mips-call-lo16) &__tls_get_addr :: (load (s64) from call-entry &__tls_get_addr) %20 = DADDiu %6, target-flags(mips-tlsldm) @__tls_guard $a0_64 = COPY %20 $gp_64 = COPY %6 JALR64Pseudo killed %19, csr_n64, implicit-def dead $ra, implicit $a0_64, implicit $gp_64, implicit-def $sp, implicit-def $v0_64 ADJCALLSTACKUP 0, 0, implicit-def dead $sp, implicit $sp %21 = COPY $v0_64 %22 = DADDiu %21, target-flags(mips-dtprel-hi) @__tls_guard %23 = LBu killed %22, target-flags(mips-dtprel-lo) @__tls_guard :: (dereferenceable load (s8) from @__tls_guard) BEQ killed %23, $zero, %bb.2.init.i.i, implicit-def dead $at B %bb.1.entry._ZTW1k.exit_crit_edge, implicit-def dead $at bb.1.entry._ZTW1k.exit_crit_edge: successors: %bb.3._ZTW1k.exit(0x80000000) ADJCALLSTACKDOWN 0, 0, implicit-def dead $sp, implicit $sp %39 = LUi64 target-flags(mips-call-hi16) &__tls_get_addr %40 = DADDu killed %39, %6 %41 = LD killed %40, target-flags(mips-call-lo16) &__tls_get_addr :: (load (s64) from call-entry &__tls_get_addr) %42 = DADDiu %6, target-flags(mips-tlsgd) @k $a0_64 = COPY %42 $gp_64 = COPY %6 JALR64Pseudo killed %41, csr_n64, implicit-def dead $ra, implicit $a0_64, implicit $gp_64, implicit-def $sp, implicit-def $v0_64 ADJCALLSTACKUP 0, 0, implicit-def dead $sp, implicit $sp %43 = COPY $v0_64 %1 = LW %43, 0 :: (dereferenceable load (s32) from @k) B %bb.3._ZTW1k.exit, implicit-def dead $at bb.2.init.i.i: successors: %bb.3._ZTW1k.exit(0x80000000) ADJCALLSTACKDOWN 0, 0, implicit-def dead $sp, implicit $sp %24 = LUi64 target-flags(mips-call-hi16) &__tls_get_addr %25 = DADDu killed %24, %6 %26 = LD %25, target-flags(mips-call-lo16) &__tls_get_addr :: (load (s64) from call-entry &__tls_get_addr) %27 = DADDiu %6, target-flags(mips-tlsldm) @__tls_guard $a0_64 = COPY %27 $gp_64 = COPY %6 JALR64Pseudo killed %26, csr_n64, implicit-def dead $ra, implicit $a0_64, implicit $gp_64, implicit-def $sp, implicit-def $v0_64 ADJCALLSTACKUP 0, 0, implicit-def dead $sp, implicit $sp %28 = COPY $v0_64 %29 = DADDiu %28, target-flags(mips-dtprel-hi) @__tls_guard %30 = ADDiu $zero, 1 SB killed %30, killed %29, target-flags(mips-dtprel-lo) @__tls_guard :: (store (s8) into @__tls_guard) ADJCALLSTACKDOWN 0, 0, implicit-def dead $sp, implicit $sp %31 = LUi64 target-flags(mips-call-hi16) @_Z1gi %32 = DADDu killed %31, %6 %33 = DADDiu $zero_64, 3 %34 = LD killed %32, target-flags(mips-call-lo16) @_Z1gi :: (load (s64) from call-entry @_Z1gi) $a0_64 = COPY %33 $gp_64 = COPY %6 JALR64Pseudo killed %34, csr_n64, implicit-def dead $ra, implicit $a0_64, implicit $gp_64, implicit-def $sp, implicit-def $v0 ADJCALLSTACKUP 0, 0, implicit-def dead $sp, implicit $sp %35 = COPY $v0 ADJCALLSTACKDOWN 0, 0, implicit-def dead $sp, implicit $sp %36 = LD %25, target-flags(mips-call-lo16) &__tls_get_addr :: (load (s64) from call-entry &__tls_get_addr) %37 = DADDiu %6, target-flags(mips-tlsgd) @k $a0_64 = COPY %37 $gp_64 = COPY %6 JALR64Pseudo killed %36, csr_n64, implicit-def dead $ra, implicit $a0_64, implicit $gp_64, implicit-def $sp, implicit-def $v0_64 ADJCALLSTACKUP 0, 0, implicit-def dead $sp, implicit $sp %38 = COPY $v0_64 SW %35, %38, 0 :: (store (s32) into @k) %2 = COPY %35 bb.3._ZTW1k.exit: successors: %bb.4(0x40000000), %bb.5._ZTW1j.exit(0x40000000) %3 = PHI %2, %bb.2.init.i.i, %1, %bb.1.entry._ZTW1k.exit_crit_edge %4 = ADDu %0, %3 %44 = LUi64 target-flags(mips-got-hi16) @_ZTH1j %45 = DADDu killed %44, %6 %46 = LD killed %45, target-flags(mips-got-lo16) @_ZTH1j :: (load (s64) from got) BEQ64 killed %46, $zero_64, %bb.5._ZTW1j.exit, implicit-def dead $at B %bb.4, implicit-def dead $at bb.4 (%ir-block.2): successors: %bb.5._ZTW1j.exit(0x80000000) ADJCALLSTACKDOWN 0, 0, implicit-def dead $sp, implicit $sp %47 = LUi64 target-flags(mips-call-hi16) @_ZTH1j %48 = DADDu killed %47, %6 %49 = LD killed %48, target-flags(mips-call-lo16) @_ZTH1j :: (load (s64) from call-entry @_ZTH1j) $gp_64 = COPY %6 JALR64Pseudo killed %49, csr_n64, implicit-def dead $ra, implicit $gp_64, implicit-def $sp ADJCALLSTACKUP 0, 0, implicit-def dead $sp, implicit $sp bb.5._ZTW1j.exit: ADJCALLSTACKDOWN 0, 0, implicit-def dead $sp, implicit $sp %50 = LUi64 target-flags(mips-call-hi16) &__tls_get_addr %51 = DADDu killed %50, %6 %52 = LD killed %51, target-flags(mips-call-lo16) &__tls_get_addr :: (load (s64) from call-entry &__tls_get_addr) %53 = DADDiu %6, target-flags(mips-tlsgd) @j $a0_64 = COPY %53 $gp_64 = COPY %6 JALR64Pseudo killed %52, csr_n64, implicit-def dead $ra, implicit $a0_64, implicit $gp_64, implicit-def $sp, implicit-def $v0_64 ADJCALLSTACKUP 0, 0, implicit-def dead $sp, implicit $sp %54 = COPY $v0_64 %55 = LW %54, 0 :: (dereferenceable load (s32) from @j) %56 = ADDu %4, killed %55 $v0 = COPY %56 RetRA implicit $v0 ...