MachineBasicBlock::iterator NMBBI = std::next(MBBI);
BuildMI(MBB, NMBBI, DL, TII.get(SP::NOP));
Modified = true;
- } else if (MI.isInlineAsm()) {
- // Look for an inline ld or ldf instruction.
- StringRef AsmString =
- MI.getOperand(InlineAsm::MIOp_AsmString).getSymbolName();
- if (AsmString.startswith_lower("ld")) {
- MachineBasicBlock::iterator NMBBI = std::next(MBBI);
- BuildMI(MBB, NMBBI, DL, TII.get(SP::NOP));
- Modified = true;
- }
}
}
}
Reg1Index = MI.getOperand(0).getReg();
Reg2Index = MI.getOperand(1).getReg();
Reg3Index = MI.getOperand(2).getReg();
- } else if (MI.isInlineAsm()) {
- std::string AsmString(
- MI.getOperand(InlineAsm::MIOp_AsmString).getSymbolName());
- std::string FMULSOpCoode("fsmuld");
- std::transform(AsmString.begin(), AsmString.end(), AsmString.begin(),
- ::tolower);
- if (AsmString.find(FMULSOpCoode) ==
- 0) { // this is an inline FSMULD instruction
-
- unsigned StartOp = InlineAsm::MIOp_FirstOperand;
-
- // extracts the registers from the inline assembly instruction
- for (unsigned i = StartOp, e = MI.getNumOperands(); i != e; ++i) {
- const MachineOperand &MO = MI.getOperand(i);
- if (MO.isReg()) {
- if (Reg1Index == UNASSIGNED_INDEX)
- Reg1Index = MO.getReg();
- else if (Reg2Index == UNASSIGNED_INDEX)
- Reg2Index = MO.getReg();
- else if (Reg3Index == UNASSIGNED_INDEX)
- Reg3Index = MO.getReg();
- }
- if (Reg3Index != UNASSIGNED_INDEX)
- break;
- }
- }
}
if (Reg1Index != UNASSIGNED_INDEX && Reg2Index != UNASSIGNED_INDEX &&
Reg1Index = MI.getOperand(0).getReg();
Reg2Index = MI.getOperand(1).getReg();
Reg3Index = MI.getOperand(2).getReg();
- } else if (MI.isInlineAsm()) {
- std::string AsmString(
- MI.getOperand(InlineAsm::MIOp_AsmString).getSymbolName());
- std::string FMULSOpCoode("fmuls");
- std::transform(AsmString.begin(), AsmString.end(), AsmString.begin(),
- ::tolower);
- if (AsmString.find(FMULSOpCoode) ==
- 0) { // this is an inline FMULS instruction
- unsigned StartOp = InlineAsm::MIOp_FirstOperand;
-
- // extracts the registers from the inline assembly instruction
- for (unsigned i = StartOp, e = MI.getNumOperands(); i != e; ++i) {
- const MachineOperand &MO = MI.getOperand(i);
- if (MO.isReg()) {
- if (Reg1Index == UNASSIGNED_INDEX)
- Reg1Index = MO.getReg();
- else if (Reg2Index == UNASSIGNED_INDEX)
- Reg2Index = MO.getReg();
- else if (Reg3Index == UNASSIGNED_INDEX)
- Reg3Index = MO.getReg();
- }
- if (Reg3Index != UNASSIGNED_INDEX)
- break;
- }
- }
}
if (Reg1Index != UNASSIGNED_INDEX && Reg2Index != UNASSIGNED_INDEX &&
MachineInstr &MI = *MBBI;
unsigned Opcode = MI.getOpcode();
- if (MI.isInlineAsm()) {
- std::string AsmString(
- MI.getOperand(InlineAsm::MIOp_AsmString).getSymbolName());
- std::string FSQRTDOpCode("fsqrtd");
- std::string FDIVDOpCode("fdivd");
- std::transform(AsmString.begin(), AsmString.end(), AsmString.begin(),
- ::tolower);
- if (AsmString.find(FSQRTDOpCode) ==
- 0) { // this is an inline fsqrts instruction
- Opcode = SP::FSQRTD;
- } else if (AsmString.find(FDIVDOpCode) ==
- 0) { // this is an inline fsqrts instruction
- Opcode = SP::FDIVD;
- }
- }
-
// Note: FDIVS and FSQRTS cannot be generated when this erratum fix is
// switched on so we don't need to check for them here. They will
// already have been converted to FSQRTD or FDIVD earlier in the
+++ /dev/null
-; RUN: llc %s -O0 -march=sparc -mcpu=ut699 -o - | FileCheck %s\r
-\r
-; CHECK-LABEL: test_fix_fsmuld_1\r
-; CHECK: fstod %f20, %f2\r
-; CHECK: fstod %f21, %f3\r
-; CHECK: fmuld %f2, %f3, %f8\r
-; CHECK: fstod %f20, %f0\r
-define double @test_fix_fsmuld_1() {\r
-entry:\r
- %a = alloca float, align 4\r
- %b = alloca float, align 4\r
- store float 0x402ECCCCC0000000, float* %a, align 4\r
- store float 0x4022333340000000, float* %b, align 4\r
- %0 = load float, float* %b, align 4\r
- %1 = load float, float* %a, align 4\r
- %mul = tail call double asm sideeffect "fsmuld $0, $1, $2", "={f20},{f21},{f8}"(float* %a, float* %b)\r
-\r
- ret double %mul\r
-}\r
-\r
-; CHECK-LABEL: test_fix_fsmuld_2\r
-; CHECK: fstod %f20, %f2\r
-; CHECK: fstod %f21, %f3\r
-; CHECK: fmuld %f2, %f3, %f8\r
-; CHECK: fstod %f20, %f0\r
-define double @test_fix_fsmuld_2(float* %a, float* %b) {\r
-entry:\r
- %mul = tail call double asm sideeffect "fsmuld $0, $1, $2", "={f20},{f21},{f8}"(float* %a, float* %b)\r
-\r
- ret double %mul\r
-}\r
%res = load i32, i32* %p
ret i32 %res
}
-
-; CHECK-LABEL: ld_inlineasm_test_1
-; CHECK: ld [%o0], %o0
-; CHECK-NEXT: !NO_APP
-; CHECK-NEXT: nop
-define float @ld_inlineasm_test_1(float* %a) {
-entry:
- %res = tail call float asm sideeffect "ld [$1], $0", "=r,r"(float* %a)
-
- ret float %res
-}
-
-; CHECK-LABEL: ld_inlineasm_test_2
-; CHECK: ld [%o0], %o0
-; CHECK-NEXT: !NO_APP
-; CHECK-NEXT: nop
-define i32 @ld_inlineasm_test_2(i32* %a) {
-entry:
- %res = tail call i32 asm sideeffect "ld [$1], $0", "=r,r"(i32* %a)
-
- ret i32 %res
-}
\ No newline at end of file
-; RUN: llc %s -O0 -march=sparc -mcpu=ut699 -o - | FileCheck %s\r
+; RUN: llc %s -O0 -march=sparc -mattr=replacefmuls -o - | FileCheck %s\r
\r
-; CHECK-LABEL: fmuls_fix_test\r
-; CHECK: fstod %f20, %f2\r
-; CHECK: fstod %f21, %f3\r
-; CHECK: fmuld %f2, %f3, %f8\r
-; CHECK: fstod %f20, %f0\r
-define double @fmuls_fix_test() {\r
+; CHECK-LABEL: test_replace_fmuls\r
+; CHECK: fsmuld %f1, %f0, %f2\r
+; CHECK: fdtos %f2, %f0\r
+; NOFIX-LABEL: test_replace_fmuls\r
+; NOFIX: fmuls %f1, %f0, %f0\r
+define float @test_replace_fmuls(float %a, float %b) {\r
entry:\r
- %a = alloca float, align 4\r
- %b = alloca float, align 4\r
- store float 0x402ECCCCC0000000, float* %a, align 4\r
- store float 0x4022333340000000, float* %b, align 4\r
- %0 = load float, float* %b, align 4\r
- %1 = load float, float* %a, align 4\r
- %mul = tail call double asm sideeffect "fmuls $0, $1, $2", "={f20},{f21},{f8}"(float* %a, float* %b)\r
+ %mul = fmul float %a, %b\r
\r
- ret double %mul\r
+ ret float %mul\r
}\r