[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
Sun Oct 9 09:54:35 PDT 2022


rjmccall added a comment.

If your goal is just to pass 16-bit types in some specific way without promotion, you can just do that in the ABI.  C only requires `short` arguments to be promoted to `int` in variadic or unprototyped positions, and it's not legal under the C type compatibility rules to call a function prototyped with a `short` parameter using an unprototyped function type.  (Not that I expect that you care deeply about supporting unprototyped function calls in HLSL anyway.)  So if you're looking an existing targets and feeling constrained by their ABI decision to promote small integer types, be aware that you can simply decide not to do that; those targets are mostly constrained by very old decisions that were informed by the state of languages and libraries a long time, and those decisions do not need to be carried forward to new targets.

But if you're sure you want to do this this way, your tests look fine.


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