[PATCH] D133668: [HLSL] Disable int16_t to avoid promote to int for HLSL.

John McCall via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Oct 18 14:56:33 PDT 2022


rjmccall added a comment.

Okay, this seems fine to me.  I think you accidentally removed the word "promotion" from the patch title, though.

I assume HLSL also provides `uint16_t`, and you should test the behavior for it.  You should also test this for whatever 8-bit types HLSL provides (`char`, `signed char`, and `unsigned char`, I assume, but maybe also `int8_t` and `uint8_t`?).



================
Comment at: clang/lib/Sema/SemaExpr.cpp:841
+    if (Ty->isPromotableIntegerType() &&
+        // Avoid promote integer type to int.
+        !getLangOpts().HLSL) {
----------------



================
Comment at: clang/test/CodeGenHLSL/basic_types.hlsl:7
 // CHECK:"?uint16_t_Val@@3GA" = global i16 0, align 2
-// CHECK:"?int16_t_Val@@3FA" = global i16 0, align 2
+// CHECK:"?int16_t_Val@@3FA" = global i16 0
 // CHECK:"?uint_Val@@3IA" = global i32 0, align 4
----------------
Why the removal of the alignment?


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