[PATCH] D133668: [HLSL] Use _BitInt(16) for int16_t to avoid promote to int.

John McCall via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Oct 10 09:37:08 PDT 2022


rjmccall added a comment.

Sure, but it's extremely easy to unpromote that arithmetic for most operators, and I'm sure LLVM already has a pass that will do that.  The only thing that blocks unpromotion is when you feed a promoted result into something that's sensitive to working on a wider value, like comparison or division, or of course an assignment to a wider type.

Alternatively, if you're worried about your ability to unpromote, and since you're breaking strict conformance anyway, have you considered just removing the initial promotion to `int` from the usual arithmetic conversions?  I'm pretty sure the rest of the rules hang together just fine if you do.  Then you have a uniform rule that permits easier vectorization for all small integer types rather than being sensitive specifically to using the `int16_t` typedef.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D133668/new/

https://reviews.llvm.org/D133668



More information about the cfe-commits mailing list