mirror of
https://github.com/capstone-engine/llvm-capstone.git
synced 2025-04-01 12:43:47 +00:00
[GlobalISel][IRTranslator] Fix crash on translation of fneg.
When the fneg IR instruction was added the code to do translation wasn't tested, and tried to get an invalid operand. llvm-svn: 352296
This commit is contained in:
parent
26a6c74fbe
commit
203760ab9c
@ -343,7 +343,7 @@ bool IRTranslator::translateFSub(const User &U, MachineIRBuilder &MIRBuilder) {
|
||||
bool IRTranslator::translateFNeg(const User &U, MachineIRBuilder &MIRBuilder) {
|
||||
MIRBuilder.buildInstr(TargetOpcode::G_FNEG)
|
||||
.addDef(getOrCreateVReg(U))
|
||||
.addUse(getOrCreateVReg(*U.getOperand(1)));
|
||||
.addUse(getOrCreateVReg(*U.getOperand(0)));
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -824,6 +824,16 @@ define float @test_frem(float %arg1, float %arg2) {
|
||||
ret float %res
|
||||
}
|
||||
|
||||
; CHECK-LABEL: name: test_fneg
|
||||
; CHECK: [[ARG1:%[0-9]+]]:_(s32) = COPY $s0
|
||||
; CHECK-NEXT: [[RES:%[0-9]+]]:_(s32) = G_FNEG [[ARG1]]
|
||||
; CHECK-NEXT: $s0 = COPY [[RES]]
|
||||
; CHECK-NEXT: RET_ReallyLR implicit $s0
|
||||
define float @test_fneg(float %arg1) {
|
||||
%res = fneg float %arg1
|
||||
ret float %res
|
||||
}
|
||||
|
||||
; CHECK-LABEL: name: test_sadd_overflow
|
||||
; CHECK: [[LHS:%[0-9]+]]:_(s32) = COPY $w0
|
||||
; CHECK: [[RHS:%[0-9]+]]:_(s32) = COPY $w1
|
||||
|
Loading…
x
Reference in New Issue
Block a user