Skip to content

Commit c9d38f3

Browse files
authored
Merge pull request #205 from maleadt/vc/fneg
Add `fneg` opcode for LLVM10
2 parents 4875482 + 9d7bf0f commit c9d38f3

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

src/core/instructions.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ Base.delete!(md::InstructionMetadataDict, kind::MD) =
9999
## instruction types
100100

101101
const opcodes = [:Ret, :Br, :Switch, :IndirectBr, :Invoke, :Unreachable, :Add, :FAdd, :Sub,
102-
:FSub, :Mul, :FMul, :UDiv, :SDiv, :FDiv, :URem, :SRem, :FRem, :Shl, :LShr,
102+
:FSub, :FNeg, :Mul, :FMul, :UDiv, :SDiv, :FDiv, :URem, :SRem, :FRem, :Shl, :LShr,
103103
:AShr, :And, :Or, :Xor, :Alloca, :Load, :Store, :GetElementPtr, :Trunc,
104104
:ZExt, :SExt, :FPToUI, :FPToSI, :UIToFP, :SIToFP, :FPTrunc, :FPExt,
105105
:PtrToInt, :IntToPtr, :BitCast, :AddrSpaceCast, :ICmp, :FCmp, :PHI, :Call,

test/irbuilder.jl

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -261,7 +261,11 @@ LLVM.Module("SomeModule", ctx) do mod
261261
@check_ir nuwneginst "sub nuw i32 0, %0"
262262

263263
fneginst = fneg!(builder, float1)
264-
@check_ir fneginst "fsub float -0.000000e+00, %2"
264+
if LLVM.version() < v"10.0.0"
265+
@check_ir fneginst "fsub float -0.000000e+00, %2"
266+
else
267+
@check_ir fneginst "fneg float %2"
268+
end
265269

266270
notinst = not!(builder, int1)
267271
@check_ir notinst "xor i32 %0, -1"

0 commit comments

Comments
 (0)