[PATCH] D53877: [IR] Strawman for dedicated FNeg IR instruction
Cameron McInally via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Tue Oct 30 12:24:01 PDT 2018
cameron.mcinally added a comment.
In https://reviews.llvm.org/D53877#1280756, @lebedev.ri wrote:
> > with the intention of adding more Unary operations in the future. E.g. integer Neg (and maybe Abs, Copysign, etc.).
>
> While there are very clear reasons for `FNeg` to exist, this isn't so true for any of the others listed here..
I don't disagree with that. On the other hand, these do seem like common enough operators to justify retiring the intrinsics and creating IR operators for them.
Also, integer Neg may have a stronger case for a dedicated IR instruction than the others. It's currently implemented as -0-x (Sub), which is pretty weird.
================
Comment at: lib/Bitcode/Writer/BitcodeWriter.cpp:521
+ default: llvm_unreachable("Unknown binary instruction!");
+ // TODO: Handle integer Neg?
+ case Instruction::FNeg: return bitc::UNOP_NEG;
----------------
lebedev.ri wrote:
> There is no integer neg opcode to handle.
Right, integer Neg is handled the same as FNeg is now. I.e. -0-x (Sub). I'm suggesting that integer Neg should also have a dedicated IR instruction. Although, that case is not as clear cut as it is for FNeg.
Repository:
rL LLVM
https://reviews.llvm.org/D53877
More information about the llvm-commits
mailing list