llvm.org GIT mirror llvm / c030038
[FastISel] Skip creating unnecessary vregs for arguments This behavior was added in r130928 for both FastISel and SD, and then disabled in r131156 for FastISel. This re-enables it for FastISel with the corresponding fix. This is triggered only when FastISel can't lower the arguments and falls back to SelectionDAG for it. FastISel contains a map of "register fixups" where at the end of the selection phase it replaces all uses of a register with another register that FastISel sometimes pre-assigned. Code at the end of SelectionDAGISel::runOnMachineFunction is doing the replacement at the very end of the function, while other pieces that come in before that look through the MachineFunction and assume everything is done. In this case, the real issue is that the code emitting COPY instructions for the liveins (physreg to vreg) (EmitLiveInCopies) is checking if the vreg assigned to the physreg is used, and if it's not, it will skip the COPY. If a register wasn't replaced with its assigned fixup yet, the copy will be skipped and we'll end up with uses of undefined registers. This fix moves the replacement of registers before the emission of copies for the live-ins. The initial motivation for this fix is to enable tail calls for swiftself functions, which were blocked because we couldn't prove that the swiftself argument (which is callee-save) comes from a function argument (live-in), because there was an extra copy (vreg to vreg). A few tests are affected by this: * llvm/test/CodeGen/AArch64/swifterror.ll: we used to spill x21 (callee-save) but never reload it because it's attached to the return. We now don't even spill it anymore. * llvm/test/CodeGen/*/swiftself.ll: we tail-call now. * llvm/test/CodeGen/AMDGPU/mubuf-legalize-operands.ll: I believe this test was not really testing the right thing, but it worked because the same registers were re-used. * llvm/test/CodeGen/ARM/cmpxchg-O0.ll: regalloc changes * llvm/test/CodeGen/ARM/swifterror.ll: get rid of a copy * llvm/test/CodeGen/Mips/*: get rid of spills and copies * llvm/test/CodeGen/SystemZ/swift-return.ll: smaller stack * llvm/test/CodeGen/X86/atomic-unordered.ll: smaller stack * llvm/test/CodeGen/X86/swifterror.ll: same as AArch64 * llvm/test/DebugInfo/X86/dbg-declare-arg.ll: stack size changed Differential Revision: https://reviews.llvm.org/D62361 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@362963 91177308-0d34-0410-b5e6-96231b3b80d8 Francis Visoiu Mistrih 4 months ago
16 changed file(s) with 230 addition(s) and 300 deletion(s). Raw diff Collapse all Expand all
97499749
97509750 // If this argument is live outside of the entry block, insert a copy from
97519751 // wherever we got it to the vreg that other BB's will reference it as.
9752 if (!TM.Options.EnableFastISel && Res.getOpcode() == ISD::CopyFromReg) {
9752 if (Res.getOpcode() == ISD::CopyFromReg) {
97539753 // If we can, though, try to skip creating an unnecessary vreg.
97549754 // FIXME: This isn't very clean... it would be nice to make this more
9755 // general. It's also subtly incompatible with the hacks FastISel
9756 // uses with vregs.
9755 // general.
97579756 unsigned Reg = cast(Res.getOperand(1))->getReg();
97589757 if (TargetRegisterInfo::isVirtualRegister(Reg)) {
97599758 FuncInfo->ValueMap[&Arg] = Reg;
502502 Fn.getContext().diagnose(DiagFallback);
503503 }
504504
505 // Replace forward-declared registers with the registers containing
506 // the desired value.
507 // Note: it is important that this happens **before** the call to
508 // EmitLiveInCopies, since implementations can skip copies of unused
509 // registers. If we don't apply the reg fixups before, some registers may
510 // appear as unused and will be skipped, resulting in bad MI.
511 MachineRegisterInfo &MRI = MF->getRegInfo();
512 for (DenseMap::iterator I = FuncInfo->RegFixups.begin(),
513 E = FuncInfo->RegFixups.end();
514 I != E; ++I) {
515 unsigned From = I->first;
516 unsigned To = I->second;
517 // If To is also scheduled to be replaced, find what its ultimate
518 // replacement is.
519 while (true) {
520 DenseMap::iterator J = FuncInfo->RegFixups.find(To);
521 if (J == E)
522 break;
523 To = J->second;
524 }
525 // Make sure the new register has a sufficiently constrained register class.
526 if (TargetRegisterInfo::isVirtualRegister(From) &&
527 TargetRegisterInfo::isVirtualRegister(To))
528 MRI.constrainRegClass(To, MRI.getRegClass(From));
529 // Replace it.
530
531 // Replacing one register with another won't touch the kill flags.
532 // We need to conservatively clear the kill flags as a kill on the old
533 // register might dominate existing uses of the new register.
534 if (!MRI.use_empty(To))
535 MRI.clearKillFlags(From);
536 MRI.replaceRegWith(From, To);
537 }
538
505539 // If the first basic block in the function has live ins that need to be
506540 // copied into vregs, emit the copies into the top of the block before
507541 // emitting the code for the block.
620654
621655 // Determine if floating point is used for msvc
622656 computeUsesMSVCFloatingPoint(TM.getTargetTriple(), Fn, MF->getMMI());
623
624 // Replace forward-declared registers with the registers containing
625 // the desired value.
626 MachineRegisterInfo &MRI = MF->getRegInfo();
627 for (DenseMap::iterator
628 I = FuncInfo->RegFixups.begin(), E = FuncInfo->RegFixups.end();
629 I != E; ++I) {
630 unsigned From = I->first;
631 unsigned To = I->second;
632 // If To is also scheduled to be replaced, find what its ultimate
633 // replacement is.
634 while (true) {
635 DenseMap::iterator J = FuncInfo->RegFixups.find(To);
636 if (J == E) break;
637 To = J->second;
638 }
639 // Make sure the new register has a sufficiently constrained register class.
640 if (TargetRegisterInfo::isVirtualRegister(From) &&
641 TargetRegisterInfo::isVirtualRegister(To))
642 MRI.constrainRegClass(To, MRI.getRegClass(From));
643 // Replace it.
644
645
646 // Replacing one register with another won't touch the kill flags.
647 // We need to conservatively clear the kill flags as a kill on the old
648 // register might dominate existing uses of the new register.
649 if (!MRI.use_empty(To))
650 MRI.clearKillFlags(From);
651 MRI.replaceRegWith(From, To);
652 }
653657
654658 TLI->finalizeLowering(*MF);
655659
234234 ; CHECK-O0: mov w{{.*}}, #16
235235 ; spill x8
236236 ; CHECK-O0-DAG: str x8
237 ; spill x21
238 ; CHECK-O0-DAG: str x21
239237 ; CHECK-O0: malloc
240238 ; CHECK-O0: mov [[ID:w[0-9]+]], #1
241239 ; CHECK-O0: strb [[ID]], [x0, #8]
4545 }
4646
4747 ; We can use a tail call if the callee swiftself is the same as the caller one.
48 ; This should also work with fast-isel.
4849 ; CHECK-LABEL: swiftself_tail:
49 ; OPT: b {{_?}}swiftself_param
50 ; OPT-NOT: ret
50 ; CHECK: b {{_?}}swiftself_param
51 ; CHECK-NOT: ret
5152 define i8* @swiftself_tail(i8* swiftself %addr0) {
5253 call void asm sideeffect "", "~{x20}"()
5354 %res = tail call i8* @swiftself_param(i8* swiftself %addr0)
124124
125125 ; CHECK-O0-DAG: s_mov_b32 [[IDX_S:s[0-9]+]], s4
126126 ; CHECK-O0-DAG: v_mov_b32_e32 [[IDX_V:v[0-9]+]], [[IDX_S]]
127 ; CHECK-O0-DAG: s_mov_b64 [[SAVEEXEC:s\[[0-9]+:[0-9]+\]]], exec
127 ; CHECK-O0-DAG: s_mov_b64 s{{\[}}[[SAVEEXEC0:[0-9]+]]:[[SAVEEXEC1:[0-9]+]]{{\]}}, exec
128128 ; CHECK-O0-DAG: buffer_store_dword [[IDX_V]], off, s[0:3], s32 offset:[[IDX_OFF:[0-9]+]] ; 4-byte Folded Spill
129 ; CHECK-O0-DAG: v_writelane_b32 [[VSAVEEXEC:v[0-9]+]], s[[SAVEEXEC0]], [[SAVEEXEC_IDX0:[0-9]+]]
130 ; CHECK-O0-DAG: v_writelane_b32 [[VSAVEEXEC:v[0-9]+]], s[[SAVEEXEC1]], [[SAVEEXEC_IDX1:[0-9]+]]
129131
130132 ; CHECK-O0: [[LOOPBB0:BB[0-9]+_[0-9]+]]:
131133 ; CHECK-O0: buffer_load_dword v[[VRSRC0:[0-9]+]], {{.*}} ; 4-byte Folded Reload
155157 ; CHECK-O0: s_xor_b64 exec, exec, [[CMP]]
156158 ; CHECK-O0-NEXT: s_cbranch_execnz [[LOOPBB0]]
157159
158 ; CHECK-O0: s_mov_b64 exec, [[SAVEEXEC]]
160 ; CHECK-O0: v_readlane_b32 s[[SAVEEXEC0:[0-9]+]], [[VSAVEEXEC]], [[SAVEEXEC_IDX0]]
161 ; CHECK-O0: v_readlane_b32 s[[SAVEEXEC1:[0-9]+]], [[VSAVEEXEC]], [[SAVEEXEC_IDX1]]
162 ; CHECK-O0: s_mov_b64 exec, s{{\[}}[[SAVEEXEC0]]:[[SAVEEXEC1]]{{\]}}
159163 ; CHECK-O0: buffer_load_dword [[RES:v[0-9]+]], off, s[0:3], s32 offset:[[RES_OFF_TMP]] ; 4-byte Folded Reload
160164 ; CHECK-O0: buffer_store_dword [[RES]], off, s[0:3], s32 offset:[[RES_OFF:[0-9]+]] ; 4-byte Folded Spill
161165 ; CHECK-O0: s_cbranch_execz [[TERMBB:BB[0-9]+_[0-9]+]]
99 ; CHECK: dmb ish
1010 ; CHECK: uxtb [[DESIRED:r[0-9]+]], [[DESIRED]]
1111 ; CHECK: [[RETRY:.LBB[0-9]+_[0-9]+]]:
12 ; CHECK: ldrexb [[OLD:r[0-9]+]], [r0]
12 ; CHECK: ldrexb [[OLD:[lr0-9]+]], [r0]
1313 ; CHECK: cmp [[OLD]], [[DESIRED]]
1414 ; CHECK: bne [[DONE:.LBB[0-9]+_[0-9]+]]
1515 ; CHECK: strexb [[STATUS:r[0-9]+]], r2, [r0]
1818 ; CHECK: [[DONE]]:
1919 ; Materialisation of a boolean is done with sub/clz/lsr
2020 ; CHECK: uxtb [[CMP1:r[0-9]+]], [[DESIRED]]
21 ; CHECK: sub{{(s)?}} [[CMP1]], [[OLD]], [[CMP1]]
21 ; CHECK: sub{{(\.w)?}} [[CMP1]], [[OLD]], [[CMP1]]
2222 ; CHECK: clz [[CMP2:r[0-9]+]], [[CMP1]]
2323 ; CHECK: lsr{{(s)?}} {{r[0-9]+}}, [[CMP2]], #5
2424 ; CHECK: dmb ish
3131 ; CHECK: dmb ish
3232 ; CHECK: uxth [[DESIRED:r[0-9]+]], [[DESIRED]]
3333 ; CHECK: [[RETRY:.LBB[0-9]+_[0-9]+]]:
34 ; CHECK: ldrexh [[OLD:r[0-9]+]], [r0]
34 ; CHECK: ldrexh [[OLD:[lr0-9]+]], [r0]
3535 ; CHECK: cmp [[OLD]], [[DESIRED]]
3636 ; CHECK: bne [[DONE:.LBB[0-9]+_[0-9]+]]
3737 ; CHECK: strexh [[STATUS:r[0-9]+]], r2, [r0]
4040 ; CHECK: [[DONE]]:
4141 ; Materialisation of a boolean is done with sub/clz/lsr
4242 ; CHECK: uxth [[CMP1:r[0-9]+]], [[DESIRED]]
43 ; CHECK: sub{{(s)?}} [[CMP1]], [[OLD]], [[CMP1]]
43 ; CHECK: sub{{(\.w)?}} [[CMP1]], [[OLD]], [[CMP1]]
4444 ; CHECK: clz [[CMP2:r[0-9]+]], [[CMP1]]
4545 ; CHECK: lsr{{(s)?}} {{r[0-9]+}}, [[CMP2]], #5
4646 ; CHECK: dmb ish
7878 ; CHECK: cmp [[OLDLO]], r6
7979 ; CHECK: cmpeq [[OLDHI]], r7
8080 ; CHECK: bne [[DONE:.LBB[0-9]+_[0-9]+]]
81 ; CHECK: strexd [[STATUS:r[0-9]+]], r4, r5, [r0]
81 ; CHECK: strexd [[STATUS:[lr0-9]+]], r4, r5, [r0]
8282 ; CHECK: cmp{{(\.w)?}} [[STATUS]], #0
8383 ; CHECK: bne [[RETRY]]
8484 ; CHECK: [[DONE]]:
184184 ; CHECK-APPLE: ble
185185
186186 ; CHECK-O0-LABEL: foo_loop:
187 ; CHECK-O0: mov r{{.*}}, r8
188187 ; CHECK-O0: cmp r{{.*}}, #0
189188 ; CHECK-O0: beq
190189 ; CHECK-O0: mov r0, #16
105105 ; MIPS32R6O0: # %bb.0: # %entry
106106 ; MIPS32R6O0-NEXT: lui $2, %hi(_gp_disp)
107107 ; MIPS32R6O0-NEXT: addiu $2, $2, %lo(_gp_disp)
108 ; MIPS32R6O0-NEXT: addiu $sp, $sp, -8
109108 ; MIPS32R6O0-NEXT: addu $1, $2, $25
110 ; MIPS32R6O0-NEXT: move $2, $4
111109 ; MIPS32R6O0-NEXT: lw $1, %got(x)($1)
112110 ; MIPS32R6O0-NEXT: $BB0_1: # %entry
113111 ; MIPS32R6O0-NEXT: # =>This Inner Loop Header: Depth=1
114 ; MIPS32R6O0-NEXT: ll $3, 0($1)
115 ; MIPS32R6O0-NEXT: addu $5, $3, $4
116 ; MIPS32R6O0-NEXT: sc $5, 0($1)
117 ; MIPS32R6O0-NEXT: beqzc $5, $BB0_1
112 ; MIPS32R6O0-NEXT: ll $2, 0($1)
113 ; MIPS32R6O0-NEXT: addu $3, $2, $4
114 ; MIPS32R6O0-NEXT: sc $3, 0($1)
115 ; MIPS32R6O0-NEXT: beqzc $3, $BB0_1
116 ; MIPS32R6O0-NEXT: nop
118117 ; MIPS32R6O0-NEXT: # %bb.2: # %entry
119 ; MIPS32R6O0-NEXT: sw $2, 4($sp) # 4-byte Folded Spill
120 ; MIPS32R6O0-NEXT: move $2, $3
121 ; MIPS32R6O0-NEXT: addiu $sp, $sp, 8
122118 ; MIPS32R6O0-NEXT: jrc $ra
123119 ;
124120 ; MIPS4-LABEL: AtomicLoadAdd32:
365361 ; MIPS32R6O0: # %bb.0: # %entry
366362 ; MIPS32R6O0-NEXT: lui $2, %hi(_gp_disp)
367363 ; MIPS32R6O0-NEXT: addiu $2, $2, %lo(_gp_disp)
368 ; MIPS32R6O0-NEXT: addiu $sp, $sp, -8
369364 ; MIPS32R6O0-NEXT: addu $1, $2, $25
370 ; MIPS32R6O0-NEXT: move $2, $4
371365 ; MIPS32R6O0-NEXT: lw $1, %got(x)($1)
372366 ; MIPS32R6O0-NEXT: $BB1_1: # %entry
373367 ; MIPS32R6O0-NEXT: # =>This Inner Loop Header: Depth=1
374 ; MIPS32R6O0-NEXT: ll $3, 0($1)
375 ; MIPS32R6O0-NEXT: subu $5, $3, $4
376 ; MIPS32R6O0-NEXT: sc $5, 0($1)
377 ; MIPS32R6O0-NEXT: beqzc $5, $BB1_1
368 ; MIPS32R6O0-NEXT: ll $2, 0($1)
369 ; MIPS32R6O0-NEXT: subu $3, $2, $4
370 ; MIPS32R6O0-NEXT: sc $3, 0($1)
371 ; MIPS32R6O0-NEXT: beqzc $3, $BB1_1
372 ; MIPS32R6O0-NEXT: nop
378373 ; MIPS32R6O0-NEXT: # %bb.2: # %entry
379 ; MIPS32R6O0-NEXT: sw $2, 4($sp) # 4-byte Folded Spill
380 ; MIPS32R6O0-NEXT: move $2, $3
381 ; MIPS32R6O0-NEXT: addiu $sp, $sp, 8
382374 ; MIPS32R6O0-NEXT: jrc $ra
383375 ;
384376 ; MIPS4-LABEL: AtomicLoadSub32:
625617 ; MIPS32R6O0: # %bb.0: # %entry
626618 ; MIPS32R6O0-NEXT: lui $2, %hi(_gp_disp)
627619 ; MIPS32R6O0-NEXT: addiu $2, $2, %lo(_gp_disp)
628 ; MIPS32R6O0-NEXT: addiu $sp, $sp, -8
629620 ; MIPS32R6O0-NEXT: addu $1, $2, $25
630 ; MIPS32R6O0-NEXT: move $2, $4
631621 ; MIPS32R6O0-NEXT: lw $1, %got(x)($1)
632622 ; MIPS32R6O0-NEXT: $BB2_1: # %entry
633623 ; MIPS32R6O0-NEXT: # =>This Inner Loop Header: Depth=1
634 ; MIPS32R6O0-NEXT: ll $3, 0($1)
635 ; MIPS32R6O0-NEXT: xor $5, $3, $4
636 ; MIPS32R6O0-NEXT: sc $5, 0($1)
637 ; MIPS32R6O0-NEXT: beqzc $5, $BB2_1
624 ; MIPS32R6O0-NEXT: ll $2, 0($1)
625 ; MIPS32R6O0-NEXT: xor $3, $2, $4
626 ; MIPS32R6O0-NEXT: sc $3, 0($1)
627 ; MIPS32R6O0-NEXT: beqzc $3, $BB2_1
628 ; MIPS32R6O0-NEXT: nop
638629 ; MIPS32R6O0-NEXT: # %bb.2: # %entry
639 ; MIPS32R6O0-NEXT: sw $2, 4($sp) # 4-byte Folded Spill
640 ; MIPS32R6O0-NEXT: move $2, $3
641 ; MIPS32R6O0-NEXT: addiu $sp, $sp, 8
642630 ; MIPS32R6O0-NEXT: jrc $ra
643631 ;
644632 ; MIPS4-LABEL: AtomicLoadXor32:
884872 ; MIPS32R6O0: # %bb.0: # %entry
885873 ; MIPS32R6O0-NEXT: lui $2, %hi(_gp_disp)
886874 ; MIPS32R6O0-NEXT: addiu $2, $2, %lo(_gp_disp)
887 ; MIPS32R6O0-NEXT: addiu $sp, $sp, -8
888875 ; MIPS32R6O0-NEXT: addu $1, $2, $25
889 ; MIPS32R6O0-NEXT: move $2, $4
890876 ; MIPS32R6O0-NEXT: lw $1, %got(x)($1)
891877 ; MIPS32R6O0-NEXT: $BB3_1: # %entry
892878 ; MIPS32R6O0-NEXT: # =>This Inner Loop Header: Depth=1
893 ; MIPS32R6O0-NEXT: ll $3, 0($1)
894 ; MIPS32R6O0-NEXT: or $5, $3, $4
895 ; MIPS32R6O0-NEXT: sc $5, 0($1)
896 ; MIPS32R6O0-NEXT: beqzc $5, $BB3_1
879 ; MIPS32R6O0-NEXT: ll $2, 0($1)
880 ; MIPS32R6O0-NEXT: or $3, $2, $4
881 ; MIPS32R6O0-NEXT: sc $3, 0($1)
882 ; MIPS32R6O0-NEXT: beqzc $3, $BB3_1
883 ; MIPS32R6O0-NEXT: nop
897884 ; MIPS32R6O0-NEXT: # %bb.2: # %entry
898 ; MIPS32R6O0-NEXT: sw $2, 4($sp) # 4-byte Folded Spill
899 ; MIPS32R6O0-NEXT: move $2, $3
900 ; MIPS32R6O0-NEXT: addiu $sp, $sp, 8
901885 ; MIPS32R6O0-NEXT: jrc $ra
902886 ;
903887 ; MIPS4-LABEL: AtomicLoadOr32:
11431127 ; MIPS32R6O0: # %bb.0: # %entry
11441128 ; MIPS32R6O0-NEXT: lui $2, %hi(_gp_disp)
11451129 ; MIPS32R6O0-NEXT: addiu $2, $2, %lo(_gp_disp)
1146 ; MIPS32R6O0-NEXT: addiu $sp, $sp, -8
11471130 ; MIPS32R6O0-NEXT: addu $1, $2, $25
1148 ; MIPS32R6O0-NEXT: move $2, $4
11491131 ; MIPS32R6O0-NEXT: lw $1, %got(x)($1)
11501132 ; MIPS32R6O0-NEXT: $BB4_1: # %entry
11511133 ; MIPS32R6O0-NEXT: # =>This Inner Loop Header: Depth=1
1152 ; MIPS32R6O0-NEXT: ll $3, 0($1)
1153 ; MIPS32R6O0-NEXT: and $5, $3, $4
1154 ; MIPS32R6O0-NEXT: sc $5, 0($1)
1155 ; MIPS32R6O0-NEXT: beqzc $5, $BB4_1
1134 ; MIPS32R6O0-NEXT: ll $2, 0($1)
1135 ; MIPS32R6O0-NEXT: and $3, $2, $4
1136 ; MIPS32R6O0-NEXT: sc $3, 0($1)
1137 ; MIPS32R6O0-NEXT: beqzc $3, $BB4_1
1138 ; MIPS32R6O0-NEXT: nop
11561139 ; MIPS32R6O0-NEXT: # %bb.2: # %entry
1157 ; MIPS32R6O0-NEXT: sw $2, 4($sp) # 4-byte Folded Spill
1158 ; MIPS32R6O0-NEXT: move $2, $3
1159 ; MIPS32R6O0-NEXT: addiu $sp, $sp, 8
11601140 ; MIPS32R6O0-NEXT: jrc $ra
11611141 ;
11621142 ; MIPS4-LABEL: AtomicLoadAnd32:
14061386 ; MIPS32R6O0: # %bb.0: # %entry
14071387 ; MIPS32R6O0-NEXT: lui $2, %hi(_gp_disp)
14081388 ; MIPS32R6O0-NEXT: addiu $2, $2, %lo(_gp_disp)
1409 ; MIPS32R6O0-NEXT: addiu $sp, $sp, -8
14101389 ; MIPS32R6O0-NEXT: addu $1, $2, $25
1411 ; MIPS32R6O0-NEXT: move $2, $4
14121390 ; MIPS32R6O0-NEXT: lw $1, %got(x)($1)
14131391 ; MIPS32R6O0-NEXT: $BB5_1: # %entry
14141392 ; MIPS32R6O0-NEXT: # =>This Inner Loop Header: Depth=1
1415 ; MIPS32R6O0-NEXT: ll $3, 0($1)
1416 ; MIPS32R6O0-NEXT: and $5, $3, $4
1417 ; MIPS32R6O0-NEXT: nor $5, $zero, $5
1418 ; MIPS32R6O0-NEXT: sc $5, 0($1)
1419 ; MIPS32R6O0-NEXT: beqzc $5, $BB5_1
1393 ; MIPS32R6O0-NEXT: ll $2, 0($1)
1394 ; MIPS32R6O0-NEXT: and $3, $2, $4
1395 ; MIPS32R6O0-NEXT: nor $3, $zero, $3
1396 ; MIPS32R6O0-NEXT: sc $3, 0($1)
1397 ; MIPS32R6O0-NEXT: beqzc $3, $BB5_1
1398 ; MIPS32R6O0-NEXT: nop
14201399 ; MIPS32R6O0-NEXT: # %bb.2: # %entry
1421 ; MIPS32R6O0-NEXT: sw $2, 4($sp) # 4-byte Folded Spill
1422 ; MIPS32R6O0-NEXT: move $2, $3
1423 ; MIPS32R6O0-NEXT: addiu $sp, $sp, 8
14241400 ; MIPS32R6O0-NEXT: jrc $ra
14251401 ;
14261402 ; MIPS4-LABEL: AtomicLoadNand32:
16911667 ; MIPS32R6O0-NEXT: addiu $2, $2, %lo(_gp_disp)
16921668 ; MIPS32R6O0-NEXT: addiu $sp, $sp, -8
16931669 ; MIPS32R6O0-NEXT: addu $1, $2, $25
1694 ; MIPS32R6O0-NEXT: move $2, $4
16951670 ; MIPS32R6O0-NEXT: sw $4, 4($sp)
1696 ; MIPS32R6O0-NEXT: lw $3, 4($sp)
1671 ; MIPS32R6O0-NEXT: lw $2, 4($sp)
16971672 ; MIPS32R6O0-NEXT: lw $1, %got(x)($1)
16981673 ; MIPS32R6O0-NEXT: $BB6_1: # %entry
16991674 ; MIPS32R6O0-NEXT: # =>This Inner Loop Header: Depth=1
1700 ; MIPS32R6O0-NEXT: ll $4, 0($1)
1701 ; MIPS32R6O0-NEXT: move $5, $3
1702 ; MIPS32R6O0-NEXT: sc $5, 0($1)
1703 ; MIPS32R6O0-NEXT: beqzc $5, $BB6_1
1675 ; MIPS32R6O0-NEXT: ll $3, 0($1)
1676 ; MIPS32R6O0-NEXT: move $4, $2
1677 ; MIPS32R6O0-NEXT: sc $4, 0($1)
1678 ; MIPS32R6O0-NEXT: beqzc $4, $BB6_1
17041679 ; MIPS32R6O0-NEXT: # %bb.2: # %entry
1705 ; MIPS32R6O0-NEXT: sw $2, 0($sp) # 4-byte Folded Spill
1706 ; MIPS32R6O0-NEXT: move $2, $4
1680 ; MIPS32R6O0-NEXT: move $2, $3
17071681 ; MIPS32R6O0-NEXT: addiu $sp, $sp, 8
17081682 ; MIPS32R6O0-NEXT: jrc $ra
17091683 ;
20101984 ; MIPS32R6O0-NEXT: addiu $2, $2, %lo(_gp_disp)
20111985 ; MIPS32R6O0-NEXT: addiu $sp, $sp, -8
20121986 ; MIPS32R6O0-NEXT: addu $1, $2, $25
2013 ; MIPS32R6O0-NEXT: move $2, $5
2014 ; MIPS32R6O0-NEXT: move $3, $4
20151987 ; MIPS32R6O0-NEXT: sw $5, 4($sp)
2016 ; MIPS32R6O0-NEXT: lw $5, 4($sp)
1988 ; MIPS32R6O0-NEXT: lw $2, 4($sp)
20171989 ; MIPS32R6O0-NEXT: lw $1, %got(x)($1)
20181990 ; MIPS32R6O0-NEXT: $BB7_1: # %entry
20191991 ; MIPS32R6O0-NEXT: # =>This Inner Loop Header: Depth=1
2020 ; MIPS32R6O0-NEXT: ll $6, 0($1)
2021 ; MIPS32R6O0-NEXT: bnec $6, $4, $BB7_3
1992 ; MIPS32R6O0-NEXT: ll $3, 0($1)
1993 ; MIPS32R6O0-NEXT: bnec $3, $4, $BB7_3
20221994 ; MIPS32R6O0-NEXT: # %bb.2: # %entry
20231995 ; MIPS32R6O0-NEXT: # in Loop: Header=BB7_1 Depth=1
2024 ; MIPS32R6O0-NEXT: move $7, $5
2025 ; MIPS32R6O0-NEXT: sc $7, 0($1)
2026 ; MIPS32R6O0-NEXT: beqzc $7, $BB7_1
1996 ; MIPS32R6O0-NEXT: move $5, $2
1997 ; MIPS32R6O0-NEXT: sc $5, 0($1)
1998 ; MIPS32R6O0-NEXT: beqzc $5, $BB7_1
20271999 ; MIPS32R6O0-NEXT: $BB7_3: # %entry
2028 ; MIPS32R6O0-NEXT: sw $2, 0($sp) # 4-byte Folded Spill
2029 ; MIPS32R6O0-NEXT: move $2, $6
2000 ; MIPS32R6O0-NEXT: move $2, $3
20302001 ; MIPS32R6O0-NEXT: addiu $sp, $sp, 8
20312002 ; MIPS32R6O0-NEXT: jrc $ra
20322003 ;
50765047 ; MIPS32R6O0-NEXT: addiu $sp, $sp, -8
50775048 ; MIPS32R6O0-NEXT: move $1, $6
50785049 ; MIPS32R6O0-NEXT: move $2, $5
5079 ; MIPS32R6O0-NEXT: move $3, $4
5080 ; MIPS32R6O0-NEXT: addiu $7, $zero, -4
5081 ; MIPS32R6O0-NEXT: and $7, $4, $7
5050 ; MIPS32R6O0-NEXT: addiu $3, $zero, -4
5051 ; MIPS32R6O0-NEXT: and $3, $4, $3
50825052 ; MIPS32R6O0-NEXT: andi $4, $4, 3
50835053 ; MIPS32R6O0-NEXT: sll $4, $4, 3
5084 ; MIPS32R6O0-NEXT: ori $8, $zero, 255
5085 ; MIPS32R6O0-NEXT: sllv $8, $8, $4
5086 ; MIPS32R6O0-NEXT: nor $9, $zero, $8
5087 ; MIPS32R6O0-NEXT: andi $10, $5, 255
5088 ; MIPS32R6O0-NEXT: sllv $10, $10, $4
5054 ; MIPS32R6O0-NEXT: ori $7, $zero, 255
5055 ; MIPS32R6O0-NEXT: sllv $7, $7, $4
5056 ; MIPS32R6O0-NEXT: nor $8, $zero, $7
5057 ; MIPS32R6O0-NEXT: andi $9, $5, 255
5058 ; MIPS32R6O0-NEXT: sllv $9, $9, $4
50895059 ; MIPS32R6O0-NEXT: andi $6, $6, 255
50905060 ; MIPS32R6O0-NEXT: sllv $6, $6, $4
50915061 ; MIPS32R6O0-NEXT: $BB13_1: # %entry
50925062 ; MIPS32R6O0-NEXT: # =>This Inner Loop Header: Depth=1
5093 ; MIPS32R6O0-NEXT: ll $12, 0($7)
5094 ; MIPS32R6O0-NEXT: and $13, $12, $8
5095 ; MIPS32R6O0-NEXT: bnec $13, $10, $BB13_3
5063 ; MIPS32R6O0-NEXT: ll $11, 0($3)
5064 ; MIPS32R6O0-NEXT: and $12, $11, $7
5065 ; MIPS32R6O0-NEXT: bnec $12, $9, $BB13_3
50965066 ; MIPS32R6O0-NEXT: # %bb.2: # %entry
50975067 ; MIPS32R6O0-NEXT: # in Loop: Header=BB13_1 Depth=1
5098 ; MIPS32R6O0-NEXT: and $12, $12, $9
5099 ; MIPS32R6O0-NEXT: or $12, $12, $6
5100 ; MIPS32R6O0-NEXT: sc $12, 0($7)
5101 ; MIPS32R6O0-NEXT: beqzc $12, $BB13_1
5068 ; MIPS32R6O0-NEXT: and $11, $11, $8
5069 ; MIPS32R6O0-NEXT: or $11, $11, $6
5070 ; MIPS32R6O0-NEXT: sc $11, 0($3)
5071 ; MIPS32R6O0-NEXT: beqzc $11, $BB13_1
51025072 ; MIPS32R6O0-NEXT: $BB13_3: # %entry
5103 ; MIPS32R6O0-NEXT: srlv $11, $13, $4
5104 ; MIPS32R6O0-NEXT: seb $11, $11
5073 ; MIPS32R6O0-NEXT: srlv $10, $12, $4
5074 ; MIPS32R6O0-NEXT: seb $10, $10
51055075 ; MIPS32R6O0-NEXT: # %bb.4: # %entry
51065076 ; MIPS32R6O0-NEXT: sw $5, 4($sp) # 4-byte Folded Spill
5107 ; MIPS32R6O0-NEXT: sw $11, 0($sp) # 4-byte Folded Spill
5077 ; MIPS32R6O0-NEXT: sw $10, 0($sp) # 4-byte Folded Spill
51085078 ; MIPS32R6O0-NEXT: # %bb.5: # %entry
51095079 ; MIPS32R6O0-NEXT: lw $1, 0($sp) # 4-byte Folded Reload
51105080 ; MIPS32R6O0-NEXT: lw $2, 4($sp) # 4-byte Folded Reload
52585228 ; MIPS64R6O0-NEXT: daddiu $sp, $sp, -16
52595229 ; MIPS64R6O0-NEXT: # kill: def $a2 killed $a2 killed $a2_64
52605230 ; MIPS64R6O0-NEXT: # kill: def $a1 killed $a1 killed $a1_64
5261 ; MIPS64R6O0-NEXT: move $1, $4
5262 ; MIPS64R6O0-NEXT: daddiu $2, $zero, -4
5263 ; MIPS64R6O0-NEXT: and $2, $4, $2
5264 ; MIPS64R6O0-NEXT: andi $3, $4, 3
5265 ; MIPS64R6O0-NEXT: xori $3, $3, 3
5266 ; MIPS64R6O0-NEXT: sll $3, $3, 3
5267 ; MIPS64R6O0-NEXT: ori $7, $zero, 255
5268 ; MIPS64R6O0-NEXT: sllv $7, $7, $3
5269 ; MIPS64R6O0-NEXT: nor $8, $zero, $7
5270 ; MIPS64R6O0-NEXT: andi $9, $5, 255
5271 ; MIPS64R6O0-NEXT: sllv $9, $9, $3
5231 ; MIPS64R6O0-NEXT: daddiu $1, $zero, -4
5232 ; MIPS64R6O0-NEXT: and $1, $4, $1
5233 ; MIPS64R6O0-NEXT: andi $2, $4, 3
5234 ; MIPS64R6O0-NEXT: xori $2, $2, 3
5235 ; MIPS64R6O0-NEXT: sll $2, $2, 3
5236 ; MIPS64R6O0-NEXT: ori $3, $zero, 255
5237 ; MIPS64R6O0-NEXT: sllv $3, $3, $2
5238 ; MIPS64R6O0-NEXT: nor $7, $zero, $3
5239 ; MIPS64R6O0-NEXT: andi $8, $5, 255
5240 ; MIPS64R6O0-NEXT: sllv $8, $8, $2
52725241 ; MIPS64R6O0-NEXT: andi $6, $6, 255
5273 ; MIPS64R6O0-NEXT: sllv $6, $6, $3
5242 ; MIPS64R6O0-NEXT: sllv $6, $6, $2
52745243 ; MIPS64R6O0-NEXT: .LBB13_1: # %entry
52755244 ; MIPS64R6O0-NEXT: # =>This Inner Loop Header: Depth=1
5276 ; MIPS64R6O0-NEXT: ll $11, 0($2)
5277 ; MIPS64R6O0-NEXT: and $12, $11, $7
5278 ; MIPS64R6O0-NEXT: bnec $12, $9, .LBB13_3
5245 ; MIPS64R6O0-NEXT: ll $10, 0($1)
5246 ; MIPS64R6O0-NEXT: and $11, $10, $3
5247 ; MIPS64R6O0-NEXT: bnec $11, $8, .LBB13_3
52795248 ; MIPS64R6O0-NEXT: # %bb.2: # %entry
52805249 ; MIPS64R6O0-NEXT: # in Loop: Header=BB13_1 Depth=1
5281 ; MIPS64R6O0-NEXT: and $11, $11, $8
5282 ; MIPS64R6O0-NEXT: or $11, $11, $6
5283 ; MIPS64R6O0-NEXT: sc $11, 0($2)
5284 ; MIPS64R6O0-NEXT: beqzc $11, .LBB13_1
5250 ; MIPS64R6O0-NEXT: and $10, $10, $7
5251 ; MIPS64R6O0-NEXT: or $10, $10, $6
5252 ; MIPS64R6O0-NEXT: sc $10, 0($1)
5253 ; MIPS64R6O0-NEXT: beqzc $10, .LBB13_1
52855254 ; MIPS64R6O0-NEXT: .LBB13_3: # %entry
5286 ; MIPS64R6O0-NEXT: srlv $10, $12, $3
5287 ; MIPS64R6O0-NEXT: seb $10, $10
5255 ; MIPS64R6O0-NEXT: srlv $9, $11, $2
5256 ; MIPS64R6O0-NEXT: seb $9, $9
52885257 ; MIPS64R6O0-NEXT: # %bb.4: # %entry
52895258 ; MIPS64R6O0-NEXT: sw $5, 12($sp) # 4-byte Folded Spill
5290 ; MIPS64R6O0-NEXT: sw $10, 8($sp) # 4-byte Folded Spill
5259 ; MIPS64R6O0-NEXT: sw $9, 8($sp) # 4-byte Folded Spill
52915260 ; MIPS64R6O0-NEXT: # %bb.5: # %entry
52925261 ; MIPS64R6O0-NEXT: lw $1, 8($sp) # 4-byte Folded Reload
52935262 ; MIPS64R6O0-NEXT: lw $2, 12($sp) # 4-byte Folded Reload
61776146 ; MIPS32R6O0-NEXT: move $1, $7
61786147 ; MIPS32R6O0-NEXT: move $2, $6
61796148 ; MIPS32R6O0-NEXT: move $3, $5
6180 ; MIPS32R6O0-NEXT: move $8, $4
61816149 ; MIPS32R6O0-NEXT: addu $5, $5, $6
61826150 ; MIPS32R6O0-NEXT: sync
61836151 ; MIPS32R6O0-NEXT: addiu $6, $zero, -4
61846152 ; MIPS32R6O0-NEXT: and $6, $4, $6
61856153 ; MIPS32R6O0-NEXT: andi $4, $4, 3
61866154 ; MIPS32R6O0-NEXT: sll $4, $4, 3
6187 ; MIPS32R6O0-NEXT: ori $9, $zero, 65535
6188 ; MIPS32R6O0-NEXT: sllv $9, $9, $4
6189 ; MIPS32R6O0-NEXT: nor $10, $zero, $9
6190 ; MIPS32R6O0-NEXT: andi $11, $5, 65535
6191 ; MIPS32R6O0-NEXT: sllv $11, $11, $4
6155 ; MIPS32R6O0-NEXT: ori $8, $zero, 65535
6156 ; MIPS32R6O0-NEXT: sllv $8, $8, $4
6157 ; MIPS32R6O0-NEXT: nor $9, $zero, $8
6158 ; MIPS32R6O0-NEXT: andi $10, $5, 65535
6159 ; MIPS32R6O0-NEXT: sllv $10, $10, $4
61926160 ; MIPS32R6O0-NEXT: andi $7, $7, 65535
61936161 ; MIPS32R6O0-NEXT: sllv $7, $7, $4
61946162 ; MIPS32R6O0-NEXT: $BB15_1: # =>This Inner Loop Header: Depth=1
6195 ; MIPS32R6O0-NEXT: ll $13, 0($6)
6196 ; MIPS32R6O0-NEXT: and $14, $13, $9
6197 ; MIPS32R6O0-NEXT: bnec $14, $11, $BB15_3
6163 ; MIPS32R6O0-NEXT: ll $12, 0($6)
6164 ; MIPS32R6O0-NEXT: and $13, $12, $8
6165 ; MIPS32R6O0-NEXT: bnec $13, $10, $BB15_3
61986166 ; MIPS32R6O0-NEXT: # %bb.2: # in Loop: Header=BB15_1 Depth=1
6199 ; MIPS32R6O0-NEXT: and $13, $13, $10
6200 ; MIPS32R6O0-NEXT: or $13, $13, $7
6201 ; MIPS32R6O0-NEXT: sc $13, 0($6)
6202 ; MIPS32R6O0-NEXT: beqzc $13, $BB15_1
6167 ; MIPS32R6O0-NEXT: and $12, $12, $9
6168 ; MIPS32R6O0-NEXT: or $12, $12, $7
6169 ; MIPS32R6O0-NEXT: sc $12, 0($6)
6170 ; MIPS32R6O0-NEXT: beqzc $12, $BB15_1
62036171 ; MIPS32R6O0-NEXT: $BB15_3:
6204 ; MIPS32R6O0-NEXT: srlv $12, $14, $4
6205 ; MIPS32R6O0-NEXT: seh $12, $12
6172 ; MIPS32R6O0-NEXT: srlv $11, $13, $4
6173 ; MIPS32R6O0-NEXT: seh $11, $11
62066174 ; MIPS32R6O0-NEXT: # %bb.4:
62076175 ; MIPS32R6O0-NEXT: sw $5, 4($sp) # 4-byte Folded Spill
6208 ; MIPS32R6O0-NEXT: sw $12, 0($sp) # 4-byte Folded Spill
6176 ; MIPS32R6O0-NEXT: sw $11, 0($sp) # 4-byte Folded Spill
62096177 ; MIPS32R6O0-NEXT: # %bb.5:
62106178 ; MIPS32R6O0-NEXT: lw $1, 4($sp) # 4-byte Folded Reload
62116179 ; MIPS32R6O0-NEXT: seh $2, $1
63886356 ; MIPS64R6O0-NEXT: sll $2, $6, 0
63896357 ; MIPS64R6O0-NEXT: # kill: def $a1 killed $a1 killed $a1_64
63906358 ; MIPS64R6O0-NEXT: sll $3, $5, 0
6391 ; MIPS64R6O0-NEXT: move $8, $4
63926359 ; MIPS64R6O0-NEXT: addu $2, $3, $2
63936360 ; MIPS64R6O0-NEXT: sync
6394 ; MIPS64R6O0-NEXT: daddiu $9, $zero, -4
6395 ; MIPS64R6O0-NEXT: and $9, $4, $9
6361 ; MIPS64R6O0-NEXT: daddiu $8, $zero, -4
6362 ; MIPS64R6O0-NEXT: and $8, $4, $8
63966363 ; MIPS64R6O0-NEXT: andi $3, $4, 3
63976364 ; MIPS64R6O0-NEXT: xori $3, $3, 2
63986365 ; MIPS64R6O0-NEXT: sll $3, $3, 3
64046371 ; MIPS64R6O0-NEXT: andi $1, $1, 65535
64056372 ; MIPS64R6O0-NEXT: sllv $1, $1, $3
64066373 ; MIPS64R6O0-NEXT: .LBB15_1: # =>This Inner Loop Header: Depth=1
6407 ; MIPS64R6O0-NEXT: ll $11, 0($9)
6408 ; MIPS64R6O0-NEXT: and $12, $11, $5
6409 ; MIPS64R6O0-NEXT: bnec $12, $7, .LBB15_3
6374 ; MIPS64R6O0-NEXT: ll $10, 0($8)
6375 ; MIPS64R6O0-NEXT: and $11, $10, $5
6376 ; MIPS64R6O0-NEXT: bnec $11, $7, .LBB15_3
64106377 ; MIPS64R6O0-NEXT: # %bb.2: # in Loop: Header=BB15_1 Depth=1
6411 ; MIPS64R6O0-NEXT: and $11, $11, $6
6412 ; MIPS64R6O0-NEXT: or $11, $11, $1
6413 ; MIPS64R6O0-NEXT: sc $11, 0($9)
6414 ; MIPS64R6O0-NEXT: beqzc $11, .LBB15_1
6378 ; MIPS64R6O0-NEXT: and $10, $10, $6
6379 ; MIPS64R6O0-NEXT: or $10, $10, $1
6380 ; MIPS64R6O0-NEXT: sc $10, 0($8)
6381 ; MIPS64R6O0-NEXT: beqzc $10, .LBB15_1
64156382 ; MIPS64R6O0-NEXT: .LBB15_3:
6416 ; MIPS64R6O0-NEXT: srlv $10, $12, $3
6417 ; MIPS64R6O0-NEXT: seh $10, $10
6383 ; MIPS64R6O0-NEXT: srlv $9, $11, $3
6384 ; MIPS64R6O0-NEXT: seh $9, $9
64186385 ; MIPS64R6O0-NEXT: # %bb.4:
64196386 ; MIPS64R6O0-NEXT: sw $2, 12($sp) # 4-byte Folded Spill
6420 ; MIPS64R6O0-NEXT: sw $10, 8($sp) # 4-byte Folded Spill
6387 ; MIPS64R6O0-NEXT: sw $9, 8($sp) # 4-byte Folded Spill
64216388 ; MIPS64R6O0-NEXT: # %bb.5:
64226389 ; MIPS64R6O0-NEXT: lw $1, 12($sp) # 4-byte Folded Reload
64236390 ; MIPS64R6O0-NEXT: seh $2, $1
67056672 ; MIPS32R6O0: # %bb.0: # %entry
67066673 ; MIPS32R6O0-NEXT: lui $2, %hi(_gp_disp)
67076674 ; MIPS32R6O0-NEXT: addiu $2, $2, %lo(_gp_disp)
6708 ; MIPS32R6O0-NEXT: addiu $sp, $sp, -8
67096675 ; MIPS32R6O0-NEXT: addu $1, $2, $25
6710 ; MIPS32R6O0-NEXT: move $2, $4
67116676 ; MIPS32R6O0-NEXT: sync
67126677 ; MIPS32R6O0-NEXT: lw $1, %got(countsint)($1)
67136678 ; MIPS32R6O0-NEXT: $BB16_1: # %entry
67146679 ; MIPS32R6O0-NEXT: # =>This Inner Loop Header: Depth=1
6715 ; MIPS32R6O0-NEXT: ll $3, 0($1)
6716 ; MIPS32R6O0-NEXT: addu $5, $3, $4
6717 ; MIPS32R6O0-NEXT: sc $5, 0($1)
6718 ; MIPS32R6O0-NEXT: beqzc $5, $BB16_1
6680 ; MIPS32R6O0-NEXT: ll $2, 0($1)
6681 ; MIPS32R6O0-NEXT: addu $3, $2, $4
6682 ; MIPS32R6O0-NEXT: sc $3, 0($1)
6683 ; MIPS32R6O0-NEXT: beqzc $3, $BB16_1
67196684 ; MIPS32R6O0-NEXT: # %bb.2: # %entry
67206685 ; MIPS32R6O0-NEXT: sync
6721 ; MIPS32R6O0-NEXT: sw $2, 4($sp) # 4-byte Folded Spill
6722 ; MIPS32R6O0-NEXT: move $2, $3
6723 ; MIPS32R6O0-NEXT: addiu $sp, $sp, 8
67246686 ; MIPS32R6O0-NEXT: jrc $ra
67256687 ;
67266688 ; MIPS4-LABEL: CheckSync:
74047366 ; MIPS32R6O0: # %bb.0: # %entry
74057367 ; MIPS32R6O0-NEXT: lui $2, %hi(_gp_disp)
74067368 ; MIPS32R6O0-NEXT: addiu $2, $2, %lo(_gp_disp)
7407 ; MIPS32R6O0-NEXT: addiu $sp, $sp, -8
74087369 ; MIPS32R6O0-NEXT: addu $1, $2, $25
7409 ; MIPS32R6O0-NEXT: move $2, $4
74107370 ; MIPS32R6O0-NEXT: lw $1, %got(x)($1)
74117371 ; MIPS32R6O0-NEXT: addiu $1, $1, 1024
74127372 ; MIPS32R6O0-NEXT: $BB18_1: # %entry
74137373 ; MIPS32R6O0-NEXT: # =>This Inner Loop Header: Depth=1
7414 ; MIPS32R6O0-NEXT: ll $3, 0($1)
7415 ; MIPS32R6O0-NEXT: addu $5, $3, $4
7416 ; MIPS32R6O0-NEXT: sc $5, 0($1)
7417 ; MIPS32R6O0-NEXT: beqzc $5, $BB18_1
7374 ; MIPS32R6O0-NEXT: ll $2, 0($1)
7375 ; MIPS32R6O0-NEXT: addu $3, $2, $4
7376 ; MIPS32R6O0-NEXT: sc $3, 0($1)
7377 ; MIPS32R6O0-NEXT: beqzc $3, $BB18_1
7378 ; MIPS32R6O0-NEXT: nop
74187379 ; MIPS32R6O0-NEXT: # %bb.2: # %entry
7419 ; MIPS32R6O0-NEXT: sw $2, 4($sp) # 4-byte Folded Spill
7420 ; MIPS32R6O0-NEXT: move $2, $3
7421 ; MIPS32R6O0-NEXT: addiu $sp, $sp, 8
74227380 ; MIPS32R6O0-NEXT: jrc $ra
74237381 ;
74247382 ; MIPS4-LABEL: AtomicLoadAdd32_OffGt9Bit:
9191 ;
9292 ; MIPS64R6O0-LABEL: AtomicLoadAdd:
9393 ; MIPS64R6O0: # %bb.0: # %entry
94 ; MIPS64R6O0-NEXT: daddiu $sp, $sp, -16
9594 ; MIPS64R6O0-NEXT: lui $1, %hi(%neg(%gp_rel(AtomicLoadAdd)))
9695 ; MIPS64R6O0-NEXT: daddu $1, $1, $25
9796 ; MIPS64R6O0-NEXT: daddiu $1, $1, %lo(%neg(%gp_rel(AtomicLoadAdd)))
98 ; MIPS64R6O0-NEXT: move $2, $4
9997 ; MIPS64R6O0-NEXT: ld $1, %got_disp(x)($1)
10098 ; MIPS64R6O0-NEXT: .LBB0_1: # %entry
10199 ; MIPS64R6O0-NEXT: # =>This Inner Loop Header: Depth=1
102 ; MIPS64R6O0-NEXT: lld $3, 0($1)
103 ; MIPS64R6O0-NEXT: daddu $5, $3, $4
104 ; MIPS64R6O0-NEXT: scd $5, 0($1)
105 ; MIPS64R6O0-NEXT: beqzc $5, .LBB0_1
100 ; MIPS64R6O0-NEXT: lld $2, 0($1)
101 ; MIPS64R6O0-NEXT: daddu $3, $2, $4
102 ; MIPS64R6O0-NEXT: scd $3, 0($1)
103 ; MIPS64R6O0-NEXT: beqzc $3, .LBB0_1
104 ; MIPS64R6O0-NEXT: nop
106105 ; MIPS64R6O0-NEXT: # %bb.2: # %entry
107 ; MIPS64R6O0-NEXT: sd $2, 8($sp) # 8-byte Folded Spill
108 ; MIPS64R6O0-NEXT: move $2, $3
109 ; MIPS64R6O0-NEXT: daddiu $sp, $sp, 16
110106 ; MIPS64R6O0-NEXT: jrc $ra
111107 ;
112108 ; O1-LABEL: AtomicLoadAdd:
252248 ;
253249 ; MIPS64R6O0-LABEL: AtomicLoadSub:
254250 ; MIPS64R6O0: # %bb.0: # %entry
255 ; MIPS64R6O0-NEXT: daddiu $sp, $sp, -16
256251 ; MIPS64R6O0-NEXT: lui $1, %hi(%neg(%gp_rel(AtomicLoadSub)))
257252 ; MIPS64R6O0-NEXT: daddu $1, $1, $25
258253 ; MIPS64R6O0-NEXT: daddiu $1, $1, %lo(%neg(%gp_rel(AtomicLoadSub)))
259 ; MIPS64R6O0-NEXT: move $2, $4
260254 ; MIPS64R6O0-NEXT: ld $1, %got_disp(x)($1)
261255 ; MIPS64R6O0-NEXT: .LBB1_1: # %entry
262256 ; MIPS64R6O0-NEXT: # =>This Inner Loop Header: Depth=1
263 ; MIPS64R6O0-NEXT: lld $3, 0($1)
264 ; MIPS64R6O0-NEXT: dsubu $5, $3, $4
265 ; MIPS64R6O0-NEXT: scd $5, 0($1)
266 ; MIPS64R6O0-NEXT: beqzc $5, .LBB1_1
257 ; MIPS64R6O0-NEXT: lld $2, 0($1)
258 ; MIPS64R6O0-NEXT: dsubu $3, $2, $4
259 ; MIPS64R6O0-NEXT: scd $3, 0($1)
260 ; MIPS64R6O0-NEXT: beqzc $3, .LBB1_1
261 ; MIPS64R6O0-NEXT: nop
267262 ; MIPS64R6O0-NEXT: # %bb.2: # %entry
268 ; MIPS64R6O0-NEXT: sd $2, 8($sp) # 8-byte Folded Spill
269 ; MIPS64R6O0-NEXT: move $2, $3
270 ; MIPS64R6O0-NEXT: daddiu $sp, $sp, 16
271263 ; MIPS64R6O0-NEXT: jrc $ra
272264 ;
273265 ; O1-LABEL: AtomicLoadSub:
413405 ;
414406 ; MIPS64R6O0-LABEL: AtomicLoadAnd:
415407 ; MIPS64R6O0: # %bb.0: # %entry
416 ; MIPS64R6O0-NEXT: daddiu $sp, $sp, -16
417408 ; MIPS64R6O0-NEXT: lui $1, %hi(%neg(%gp_rel(AtomicLoadAnd)))
418409 ; MIPS64R6O0-NEXT: daddu $1, $1, $25
419410 ; MIPS64R6O0-NEXT: daddiu $1, $1, %lo(%neg(%gp_rel(AtomicLoadAnd)))
420 ; MIPS64R6O0-NEXT: move $2, $4
421411 ; MIPS64R6O0-NEXT: ld $1, %got_disp(x)($1)
422412 ; MIPS64R6O0-NEXT: .LBB2_1: # %entry
423413 ; MIPS64R6O0-NEXT: # =>This Inner Loop Header: Depth=1
424 ; MIPS64R6O0-NEXT: lld $3, 0($1)
425 ; MIPS64R6O0-NEXT: and $5, $3, $4
426 ; MIPS64R6O0-NEXT: scd $5, 0($1)
427 ; MIPS64R6O0-NEXT: beqzc $5, .LBB2_1
414 ; MIPS64R6O0-NEXT: lld $2, 0($1)
415 ; MIPS64R6O0-NEXT: and $3, $2, $4
416 ; MIPS64R6O0-NEXT: scd $3, 0($1)
417 ; MIPS64R6O0-NEXT: beqzc $3, .LBB2_1
418 ; MIPS64R6O0-NEXT: nop
428419 ; MIPS64R6O0-NEXT: # %bb.2: # %entry
429 ; MIPS64R6O0-NEXT: sd $2, 8($sp) # 8-byte Folded Spill
430 ; MIPS64R6O0-NEXT: move $2, $3
431 ; MIPS64R6O0-NEXT: daddiu $sp, $sp, 16
432420 ; MIPS64R6O0-NEXT: jrc $ra
433421 ;
434422 ; O1-LABEL: AtomicLoadAnd:
574562 ;
575563 ; MIPS64R6O0-LABEL: AtomicLoadOr:
576564 ; MIPS64R6O0: # %bb.0: # %entry
577 ; MIPS64R6O0-NEXT: daddiu $sp, $sp, -16
578565 ; MIPS64R6O0-NEXT: lui $1, %hi(%neg(%gp_rel(AtomicLoadOr)))
579566 ; MIPS64R6O0-NEXT: daddu $1, $1, $25
580567 ; MIPS64R6O0-NEXT: daddiu $1, $1, %lo(%neg(%gp_rel(AtomicLoadOr)))
581 ; MIPS64R6O0-NEXT: move $2, $4
582568 ; MIPS64R6O0-NEXT: ld $1, %got_disp(x)($1)
583569 ; MIPS64R6O0-NEXT: .LBB3_1: # %entry
584570 ; MIPS64R6O0-NEXT: # =>This Inner Loop Header: Depth=1
585 ; MIPS64R6O0-NEXT: lld $3, 0($1)
586 ; MIPS64R6O0-NEXT: or $5, $3, $4
587 ; MIPS64R6O0-NEXT: scd $5, 0($1)
588 ; MIPS64R6O0-NEXT: beqzc $5, .LBB3_1
571 ; MIPS64R6O0-NEXT: lld $2, 0($1)
572 ; MIPS64R6O0-NEXT: or $3, $2, $4
573 ; MIPS64R6O0-NEXT: scd $3, 0($1)
574 ; MIPS64R6O0-NEXT: beqzc $3, .LBB3_1
575 ; MIPS64R6O0-NEXT: nop
589576 ; MIPS64R6O0-NEXT: # %bb.2: # %entry
590 ; MIPS64R6O0-NEXT: sd $2, 8($sp) # 8-byte Folded Spill
591 ; MIPS64R6O0-NEXT: move $2, $3
592 ; MIPS64R6O0-NEXT: daddiu $sp, $sp, 16
593577 ; MIPS64R6O0-NEXT: jrc $ra
594578 ;
595579 ; O1-LABEL: AtomicLoadOr:
735719 ;
736720 ; MIPS64R6O0-LABEL: AtomicLoadXor:
737721 ; MIPS64R6O0: # %bb.0: # %entry
738 ; MIPS64R6O0-NEXT: daddiu $sp, $sp, -16
739722 ; MIPS64R6O0-NEXT: lui $1, %hi(%neg(%gp_rel(AtomicLoadXor)))
740723 ; MIPS64R6O0-NEXT: daddu $1, $1, $25
741724 ; MIPS64R6O0-NEXT: daddiu $1, $1, %lo(%neg(%gp_rel(AtomicLoadXor)))
742 ; MIPS64R6O0-NEXT: move $2, $4
743725 ; MIPS64R6O0-NEXT: ld $1, %got_disp(x)($1)
744726 ; MIPS64R6O0-NEXT: .LBB4_1: # %entry
745727 ; MIPS64R6O0-NEXT: # =>This Inner Loop Header: Depth=1
746 ; MIPS64R6O0-NEXT: lld $3, 0($1)
747 ; MIPS64R6O0-NEXT: xor $5, $3, $4
748 ; MIPS64R6O0-NEXT: scd $5, 0($1)
749 ; MIPS64R6O0-NEXT: beqzc $5, .LBB4_1
728 ; MIPS64R6O0-NEXT: lld $2, 0($1)
729 ; MIPS64R6O0-NEXT: xor $3, $2, $4
730 ; MIPS64R6O0-NEXT: scd $3, 0($1)
731 ; MIPS64R6O0-NEXT: beqzc $3, .LBB4_1
732 ; MIPS64R6O0-NEXT: nop
750733 ; MIPS64R6O0-NEXT: # %bb.2: # %entry
751 ; MIPS64R6O0-NEXT: sd $2, 8($sp) # 8-byte Folded Spill
752 ; MIPS64R6O0-NEXT: move $2, $3
753 ; MIPS64R6O0-NEXT: daddiu $sp, $sp, 16
754734 ; MIPS64R6O0-NEXT: jrc $ra
755735 ;
756736 ; O1-LABEL: AtomicLoadXor:
900880 ;
901881 ; MIPS64R6O0-LABEL: AtomicLoadNand:
902882 ; MIPS64R6O0: # %bb.0: # %entry
903 ; MIPS64R6O0-NEXT: daddiu $sp, $sp, -16
904883 ; MIPS64R6O0-NEXT: lui $1, %hi(%neg(%gp_rel(AtomicLoadNand)))
905884 ; MIPS64R6O0-NEXT: daddu $1, $1, $25
906885 ; MIPS64R6O0-NEXT: daddiu $1, $1, %lo(%neg(%gp_rel(AtomicLoadNand)))
907 ; MIPS64R6O0-NEXT: move $2, $4
908886 ; MIPS64R6O0-NEXT: ld $1, %got_disp(x)($1)
909887 ; MIPS64R6O0-NEXT: .LBB5_1: # %entry
910888 ; MIPS64R6O0-NEXT: # =>This Inner Loop Header: Depth=1
911 ; MIPS64R6O0-NEXT: lld $3, 0($1)
912 ; MIPS64R6O0-NEXT: and $5, $3, $4
913 ; MIPS64R6O0-NEXT: nor $5, $zero, $5
914 ; MIPS64R6O0-NEXT: scd $5, 0($1)
915 ; MIPS64R6O0-NEXT: beqzc $5, .LBB5_1
889 ; MIPS64R6O0-NEXT: lld $2, 0($1)
890 ; MIPS64R6O0-NEXT: and $3, $2, $4
891 ; MIPS64R6O0-NEXT: nor $3, $zero, $3
892 ; MIPS64R6O0-NEXT: scd $3, 0($1)
893 ; MIPS64R6O0-NEXT: beqzc $3, .LBB5_1
894 ; MIPS64R6O0-NEXT: nop
916895 ; MIPS64R6O0-NEXT: # %bb.2: # %entry
917 ; MIPS64R6O0-NEXT: sd $2, 8($sp) # 8-byte Folded Spill
918 ; MIPS64R6O0-NEXT: move $2, $3
919 ; MIPS64R6O0-NEXT: daddiu $sp, $sp, 16
920896 ; MIPS64R6O0-NEXT: jrc $ra
921897 ;
922898 ; O1-LABEL: AtomicLoadNand:
10791055 ; MIPS64R6O0-NEXT: lui $1, %hi(%neg(%gp_rel(AtomicSwap64)))
10801056 ; MIPS64R6O0-NEXT: daddu $1, $1, $25
10811057 ; MIPS64R6O0-NEXT: daddiu $1, $1, %lo(%neg(%gp_rel(AtomicSwap64)))
1082 ; MIPS64R6O0-NEXT: move $2, $4
10831058 ; MIPS64R6O0-NEXT: sd $4, 8($sp)
1084 ; MIPS64R6O0-NEXT: ld $3, 8($sp)
1059 ; MIPS64R6O0-NEXT: ld $2, 8($sp)
10851060 ; MIPS64R6O0-NEXT: ld $1, %got_disp(x)($1)
10861061 ; MIPS64R6O0-NEXT: .LBB6_1: # %entry
10871062 ; MIPS64R6O0-NEXT: # =>This Inner Loop Header: Depth=1
1088 ; MIPS64R6O0-NEXT: lld $4, 0($1)
1089 ; MIPS64R6O0-NEXT: move $5, $3
1090 ; MIPS64R6O0-NEXT: scd $5, 0($1)
1091 ; MIPS64R6O0-NEXT: beqzc $5, .LBB6_1
1063 ; MIPS64R6O0-NEXT: lld $3, 0($1)
1064 ; MIPS64R6O0-NEXT: move $4, $2
1065 ; MIPS64R6O0-NEXT: scd $4, 0($1)
1066 ; MIPS64R6O0-NEXT: beqzc $4, .LBB6_1
10921067 ; MIPS64R6O0-NEXT: # %bb.2: # %entry
1093 ; MIPS64R6O0-NEXT: sd $2, 0($sp) # 8-byte Folded Spill
1094 ; MIPS64R6O0-NEXT: move $2, $4
1068 ; MIPS64R6O0-NEXT: move $2, $3
10951069 ; MIPS64R6O0-NEXT: daddiu $sp, $sp, 16
10961070 ; MIPS64R6O0-NEXT: jrc $ra
10971071 ;
12771251 ; MIPS64R6O0-NEXT: lui $1, %hi(%neg(%gp_rel(AtomicCmpSwap64)))
12781252 ; MIPS64R6O0-NEXT: daddu $1, $1, $25
12791253 ; MIPS64R6O0-NEXT: daddiu $1, $1, %lo(%neg(%gp_rel(AtomicCmpSwap64)))
1280 ; MIPS64R6O0-NEXT: move $2, $5
1281 ; MIPS64R6O0-NEXT: move $3, $4
12821254 ; MIPS64R6O0-NEXT: sd $5, 8($sp)
1283 ; MIPS64R6O0-NEXT: ld $5, 8($sp)
1255 ; MIPS64R6O0-NEXT: ld $2, 8($sp)
12841256 ; MIPS64R6O0-NEXT: ld $1, %got_disp(x)($1)
12851257 ; MIPS64R6O0-NEXT: .LBB7_1: # %entry
12861258 ; MIPS64R6O0-NEXT: # =>This Inner Loop Header: Depth=1
1287 ; MIPS64R6O0-NEXT: lld $6, 0($1)
1288 ; MIPS64R6O0-NEXT: bnec $6, $4, .LBB7_3
1259 ; MIPS64R6O0-NEXT: lld $3, 0($1)
1260 ; MIPS64R6O0-NEXT: bnec $3, $4, .LBB7_3
12891261 ; MIPS64R6O0-NEXT: # %bb.2: # %entry
12901262 ; MIPS64R6O0-NEXT: # in Loop: Header=BB7_1 Depth=1
1291 ; MIPS64R6O0-NEXT: move $7, $5
1292 ; MIPS64R6O0-NEXT: scd $7, 0($1)
1293 ; MIPS64R6O0-NEXT: beqzc $7, .LBB7_1
1263 ; MIPS64R6O0-NEXT: move $5, $2
1264 ; MIPS64R6O0-NEXT: scd $5, 0($1)
1265 ; MIPS64R6O0-NEXT: beqzc $5, .LBB7_1
12941266 ; MIPS64R6O0-NEXT: .LBB7_3: # %entry
1295 ; MIPS64R6O0-NEXT: sd $2, 0($sp) # 8-byte Folded Spill
1296 ; MIPS64R6O0-NEXT: move $2, $6
1267 ; MIPS64R6O0-NEXT: move $2, $3
12971268 ; MIPS64R6O0-NEXT: daddiu $sp, $sp, 16
12981269 ; MIPS64R6O0-NEXT: jrc $ra
12991270 ;
1010 define void @foo(i32 %new, i32 %old) {
1111 ; O32-LABEL: foo:
1212 ; O32: # %bb.0: # %entry
13 ; O32-NEXT: move $1, $5
14 ; O32-NEXT: move $2, $4
15 ; O32-NEXT: lui $3, %hi(sym)
16 ; O32-NEXT: lw $3, %lo(sym)($3)
13 ; O32-NEXT: lui $1, %hi(sym)
14 ; O32-NEXT: lw $1, %lo(sym)($1)
1715 ; O32-NEXT: sync
1816 ; O32-NEXT: $BB0_1: # %entry
1917 ; O32-NEXT: # =>This Inner Loop Header: Depth=1
20 ; O32-NEXT: ll $6, 0($3)
21 ; O32-NEXT: bne $6, $4, $BB0_3
18 ; O32-NEXT: ll $2, 0($1)
19 ; O32-NEXT: bne $2, $4, $BB0_3
2220 ; O32-NEXT: nop
2321 ; O32-NEXT: # %bb.2: # %entry
2422 ; O32-NEXT: # in Loop: Header=BB0_1 Depth=1
25 ; O32-NEXT: move $7, $5
26 ; O32-NEXT: sc $7, 0($3)
27 ; O32-NEXT: beqz $7, $BB0_1
23 ; O32-NEXT: move $3, $5
24 ; O32-NEXT: sc $3, 0($1)
25 ; O32-NEXT: beqz $3, $BB0_1
2826 ; O32-NEXT: nop
2927 ; O32-NEXT: $BB0_3: # %entry
3028 ; O32-NEXT: sync
2525
2626 ; MM-OBJ: sw ${{[0-9]+}}, {{[0-9]+}}($sp)
2727 ; MM-OBJ: sw ${{[0-9]+}}, {{[0-9]+}}($sp)
28 ; MM-OBJ: sw ${{[0-9]+}}, {{[0-9]+}}($sp)
2928
3029 true:
3130 ret <4 x i8> %c
4949 ; CHECK-O0-LABEL: test2:
5050 ; CHECK-O0: st %r2, [[SPILL1:[0-9]+]](%r15)
5151 ; CHECK-O0: l %r3, [[SPILL1]](%r15)
52 ; CHECK-O0: la %r2, 168(%r15)
52 ; CHECK-O0: la %r2, 160(%r15)
5353 ; CHECK-O0: brasl %r14, gen2
54 ; CHECK-O0-DAG: l %r{{.*}}, 184(%r15)
55 ; CHECK-O0-DAG: l %r{{.*}}, 180(%r15)
5654 ; CHECK-O0-DAG: l %r{{.*}}, 176(%r15)
5755 ; CHECK-O0-DAG: l %r{{.*}}, 172(%r15)
5856 ; CHECK-O0-DAG: l %r{{.*}}, 168(%r15)
57 ; CHECK-O0-DAG: l %r{{.*}}, 164(%r15)
58 ; CHECK-O0-DAG: l %r{{.*}}, 160(%r15)
5959 ; CHECK-O0: ar
6060 ; CHECK-O0: ar
6161 ; CHECK-O0: ar
313313 ; CHECK-O0-NEXT: .cfi_offset %rbx, -16
314314 ; CHECK-O0-NEXT: movq (%rdi), %rax
315315 ; CHECK-O0-NEXT: movq 8(%rdi), %rcx
316 ; CHECK-O0-NEXT: movq %rdi, {{[-0-9]+}}(%r{{[sb]}}p) # 8-byte Spill
316317 ; CHECK-O0-NEXT: movq %rdx, {{[-0-9]+}}(%r{{[sb]}}p) # 8-byte Spill
317318 ; CHECK-O0-NEXT: movq %rsi, {{[-0-9]+}}(%r{{[sb]}}p) # 8-byte Spill
318 ; CHECK-O0-NEXT: movq %rdi, {{[-0-9]+}}(%r{{[sb]}}p) # 8-byte Spill
319319 ; CHECK-O0-NEXT: movq %rax, {{[-0-9]+}}(%r{{[sb]}}p) # 8-byte Spill
320320 ; CHECK-O0-NEXT: movq %rcx, {{[-0-9]+}}(%r{{[sb]}}p) # 8-byte Spill
321321 ; CHECK-O0-NEXT: jmp .LBB16_1
434434
435435 ; CHECK-O0-LABEL: conditionally_forward_swifterror:
436436 ; CHECK-O0: pushq [[REG1:%[a-z0-9]+]]
437 ; CHECK-O0: movq %r12, [[REG1]]
438437 ; CHECK-O0: cmpl $0, %edi
439438 ; CHECK-O0-DAG: movq %r12, (%rsp)
440439 ; CHECK-O0: je
743742 }
744743
745744 ; CHECK-O0-LABEL: testAssign2
746 ; CHECK-O0: movq %r12, {{.*}}
747745 ; CHECK-O0: movq %r12, [[SLOT:[-a-z0-9\(\)\%]*]]
748746 ; CHECK-O0: jmp
749747 ; CHECK-O0: movq [[SLOT]], %rax
790788
791789 ; CHECK-O0-LABEL: testAssign4
792790 ; CHECK-O0: callq _foo2
793 ; CHECK-O0: xorl %ecx, %ecx
794 ; CHECK-O0: movl %ecx, %eax
795 ; CHECK-O0: movq %rax, [[SLOT:[-a-z0-9\(\)\%]*]]
791 ; CHECK-O0: xorl %eax, %eax
792 ; CHECK-O0: movl %eax, %ecx
793 ; CHECK-O0: movq %rcx, [[SLOT:[-a-z0-9\(\)\%]*]]
796794 ; CHECK-O0: movq [[SLOT]], %rax
797795 ; CHECK-O0: movq %rax, [[SLOT2:[-a-z0-9\(\)\%]*]]
798796 ; CHECK-O0: movq [[SLOT2]], %r12
4040 }
4141
4242 ; We can use a tail call if the callee swiftself is the same as the caller one.
43 ; This should also work with fast-isel.
4344 ; CHECK-LABEL: swiftself_tail:
44 ; OPT: jmp {{_?}}swiftself_param
45 ; OPT-NOT: ret
45 ; CHECK: jmp {{_?}}swiftself_param
46 ; CHECK-NOT: ret
4647 define i8* @swiftself_tail(i8* swiftself %addr0) {
4748 call void asm sideeffect "", "~{r13}"()
4849 %res = tail call i8* @swiftself_param(i8* swiftself %addr0)
1919 ; CHECK: DW_AT_name {{.*}}"j"
2020 ; CHECK: DW_TAG_variable
2121 ; CHECK-NEXT: DW_AT_location [DW_FORM_sec_offset] (
22 ; CHECK-NEXT: [0x{{.*}}, 0x{{.*}}): DW_OP_breg7 RSP+8, DW_OP_deref)
22 ; CHECK-NEXT: [0x{{.*}}, 0x{{.*}}): DW_OP_breg7 RSP+16, DW_OP_deref)
2323 ; CHECK-NEXT: DW_AT_name {{.*}}"my_a"
2424
2525 %class.A = type { i32, i32, i32, i32 }