Skip to content

Commit

Permalink
Merge pull request JuliaLang#14305 from eschnett/eschnett/neg
Browse files Browse the repository at this point in the history
Use `CreateNeg` for integer unary minus with newer LLVM versions
  • Loading branch information
jakebolewski committed Dec 8, 2015
2 parents 844d5d5 + 6e3d351 commit 14bb60a
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/intrinsics.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1150,7 +1150,12 @@ static Value *emit_untyped_intrinsic(intrinsic f, Value *x, Value *y, Value *z,
Value *den;
Value *typemin;
switch (f) {
case neg_int: return builder.CreateSub(ConstantInt::get(t, 0), JL_INT(x));
case neg_int:
#ifdef LLVM37
return builder.CreateNeg(JL_INT(x));
#else
return builder.CreateSub(ConstantInt::get(t, 0), JL_INT(x));
#endif
case add_int: return builder.CreateAdd(JL_INT(x), JL_INT(y));
case sub_int: return builder.CreateSub(JL_INT(x), JL_INT(y));
case mul_int: return builder.CreateMul(JL_INT(x), JL_INT(y));
Expand Down

0 comments on commit 14bb60a

Please sign in to comment.