Upcoming API change: FAdd, FSub, FMul

Hello,

The LLVM IR opcodes Add, Sub, and Mul have been each split into
two. Add, Sub, and Mul now only handle integer types, and three
new opcodes, FAdd, FSub, and FMul now handle floating-point types.

The main LLVM APIs are currently preserving backwards
compatibility, transparently mapping integer opcodes to
corresponding floating-point opcodes when the operands have
floating-point types. This compatibility code will eventually be
removed, so front-end writers should update their front-ends to
use the new opcodes. I've updated llvm-gcc as an example.

As an aid to this process, the attached patch can be applied to a
local LLVM tree to remove the backward-compatibility code, to
allow front-ends to be tested.

add-fadd.patch (3.09 KB)

The LLVM IR opcodes Add, Sub, and Mul have been each split into
two. Add, Sub, and Mul now only handle integer types, and three
new opcodes, FAdd, FSub, and FMul now handle floating-point types.

Dan,

Wondering the reason why there is no FDiv ?

Thanks,

Aaron

FDiv already exists; div was split quite a while ago.

Dan

The LLVM IR opcodes Add, Sub, and Mul have been each split into
two. Add, Sub, and Mul now only handle integer types, and three
new opcodes, FAdd, FSub, and FMul now handle floating-point types.

Dan,

Wondering the reason why there is no FDiv ?

FDiv already exists; div was split quite a while ago.

just me wondering:
what is the reasoning behind this API change?...

Aaron Gray wrote:

The LLVM IR opcodes Add, Sub, and Mul have been each split into
two. Add, Sub, and Mul now only handle integer types, and three
new opcodes, FAdd, FSub, and FMul now handle floating-point types.

Dan,

Wondering the reason why there is no FDiv ?

It already existed, and still does: LLVM Language Reference Manual — LLVM 18.0.0git documentation

Ah, right I must have missed its introduction.

Thanks,

Aaron

It makes the IR a little more consistent, and it's the first
step to implement the functionality outlined here:

http://nondot.org/sabre/LLVMNotes/IntegerOverflow.txt

Also, some day the floating-point instructions will likely be
extended with floating-point-specific flags.

Dan

Thanks Dan, fwiw, I updated clang.

-Chris