This is an archive of the discontinued LLVM Phabricator instance.

[VE] Support floating point immediate values
ClosedPublic

Authored by kaz7 on Apr 26 2020, 4:48 PM.

Details

Summary

Add simm7fp/mimmfp to represent floating point immediate values.
Also clean multiclasses to define floating point arithmetic instructions
to handle simm7fp/mimmfp operands. Also add several regression tests
for new operands.

Diff Detail

Event Timeline

kaz7 created this revision.Apr 26 2020, 4:48 PM

Thanks! Minor comments inline.

llvm/lib/Target/VE/VEInstrInfo.td
100

Could you document the purpose of this constant with a comment?

107

Maybe cache the Imm.getSExtValue() result as done above and use that variable instead.

458

same as below

465

I suppose you could write this more naturally as multiclass RRNCm<...> : RRNCbm<...>;

llvm/test/CodeGen/VE/fp_mul.ll
97

I guess this is one of those cases where it makes sense to use a fp hex constant: it is shorter and the expected output relates to the bitencoding anyway.

kaz7 updated this revision to Diff 260237.Apr 27 2020, 1:15 AM

Modify codes to follow simon-san's suggestions.

kaz7 marked 5 inline comments as done.Apr 27 2020, 1:19 AM
kaz7 added inline comments.
llvm/lib/Target/VE/VEInstrInfo.td
100

Add it. Thanks.

107

Did it.

458

Did it.

465

Did it. I've not know how to write it. Thanks!

llvm/test/CodeGen/VE/fp_mul.ll
97

I wish I could. Recently, llvm is modified to not use hex values in llvm-ir. After that, llc doesn't accept hex values when I tried to use hex values. Please let me know if you know how to write it in the current version. Thanks.

simoll added inline comments.Apr 27 2020, 1:54 AM
llvm/test/CodeGen/VE/fp_mul.ll
97

The IR in line 61 uses a hex fp constant. I'd expect this to work here too.

kaz7 marked an inline comment as done.Apr 27 2020, 3:21 PM
kaz7 added inline comments.
llvm/test/CodeGen/VE/fp_mul.ll
97

Yeah. That causes these errors. I tried them and I failed previously.

If I try 0x007FFFFF:

/usr/uhome/aurora/fccg/marukawa/llvm-dev/build-debug-upstream/bin/llc: error: /usr/uhome/aurora/fccg/marukawa/llvm-dev/build-debug-upstream/bin/llc: <stdin>:97:23: error: floating point constant invalid for type
  %r = fmul float %a, 0x007FFFFF

If I try 0x007FFFFFFFFFFFFF:

/usr/uhome/aurora/fccg/marukawa/llvm-dev/build-debug-upstream/bin/llc: error: /usr/uhome/aurora/fccg/marukawa/llvm-dev/build-debug-upstream/bin/llc: <stdin>:97:23: error: floating point constant invalid for type
  %r = fmul float %a, 0x007FFFFFFFFFFFFF
simoll accepted this revision.Apr 28 2020, 12:31 AM
simoll added a subscriber: arsenm.

LGTM, then. We should followup on the denormal fp constant issue (getting @arsenm in the loop who has been working on proper fp support).

llvm/test/CodeGen/VE/fp_mul.ll
97

Apparently, LLVM does not like denormal hex fp constants. I suppose that should be considered a bug since it is still a valid fp specification.
We should not stall this patch until that is fixed but look up the rationale for not accepting denormals and/or raise the issue on llvm-dev.

This revision is now accepted and ready to land.Apr 28 2020, 12:31 AM
This revision was automatically updated to reflect the committed changes.