This is an archive of the discontinued LLVM Phabricator instance.

[ConstantFolding] Constant fold minimum and maximum intrinsics
ClosedPublic

Authored by tlively on Oct 1 2018, 7:55 PM.

Diff Detail

Repository
rL LLVM

Event Timeline

tlively created this revision.Oct 1 2018, 7:55 PM
arsenm added a subscriber: arsenm.Oct 1 2018, 8:04 PM

This is already done? See test/Transforms/InstCombine/{minnum,maxnum}.ll

This is already done? See test/Transforms/InstCombine/{minnum,maxnum}.ll

This is for two proposed new intrinsics that have the draft IEEE 754-2018 semantics (NaN propagation and defined ordering of signed zeros) as opposed to minnum and maxnum's IEEE 754-2008 semantics.

arsenm added a comment.Oct 1 2018, 8:08 PM

This is already done? See test/Transforms/InstCombine/{minnum,maxnum}.ll

Turns out I can't read

arsenm added a comment.Oct 1 2018, 8:09 PM

This is already done? See test/Transforms/InstCombine/{minnum,maxnum}.ll

This is for two proposed new intrinsics that have the draft IEEE 754-2018 semantics (NaN propagation and defined ordering of signed zeros) as opposed to minnum and maxnum's IEEE 754-2008 semantics.

The minnum/mixnum intrinsics don't follow the IEEE 754-2008 NaN propagation rules

This is already done? See test/Transforms/InstCombine/{minnum,maxnum}.ll

This is for two proposed new intrinsics that have the draft IEEE 754-2018 semantics (NaN propagation and defined ordering of signed zeros) as opposed to minnum and maxnum's IEEE 754-2008 semantics.

The minnum/mixnum intrinsics don't follow the IEEE 754-2008 NaN propagation rules

Not regarding quiet NaNs and such, but they do return their non-NaN argument just like the min and max operations specified in IEEE 754-2008.

aheejin added inline comments.Oct 4 2018, 7:19 AM
test/Analysis/ConstantFolding/min-max.ll
14 ↗(On Diff #167875)

Maybe add one or two line comments about what the expectations are for each test?

49 ↗(On Diff #167875)

Maybe add tests with zeros for minnum and maxnum too to show they can't be constant folded?

tlively updated this revision to Diff 168369.Oct 4 2018, 1:54 PM
  • Add constant folding tests for minnum/maxnum on zeroes
tlively marked an inline comment as done.Oct 4 2018, 1:55 PM
tlively added inline comments.
test/Analysis/ConstantFolding/min-max.ll
49 ↗(On Diff #167875)

Done, but showing that they can be constant folded. The new tests allow either positive or negative zero when both as passed as arguments.

tlively updated this revision to Diff 169112.Oct 10 2018, 3:21 PM
tlively marked 2 inline comments as done.
  • Add comments
aheejin accepted this revision.Oct 17 2018, 3:53 PM

Thanks!

This revision is now accepted and ready to land.Oct 17 2018, 3:53 PM
This revision was automatically updated to reflect the committed changes.