================
@@ -297,12 +297,12 @@ _CLC_DEF _CLC_OVERLOAD __CLC_INTN 
__clc_argReductionLargeS(
       __CLC_AS_FLOATN(sign | ((127U - __CLC_AS_UINTN(xe)) << 23U) | p7 >> 9);
 
   // Shift out bits we captured on q1
-  p7 = bitalign(p7, p6, 32 - 23);
+  p7 = bitalign(p7, p6, (__CLC_UINTN)(32u - 23u));
 
   // Get 24 more bits of fraction in another float, there are not long strings
   // of zeroes here
   __CLC_INTN xxe = __CLC_AS_INTN(__clc_clz(p7)) + 1;
-  p7 = bitalign(p7, p6, 32 - xxe);
+  p7 = bitalign(p7, p6, __CLC_CONVERT_UINTN(32 - xxe));
----------------
arsenm wrote:

This isn't sufficient, and just moves the cast below:
```
-  __CLC_INTN xxe = __CLC_AS_INTN(__clc_clz(p7)) + 1;
-  p7 = bitalign(p7, p6, __CLC_CONVERT_UINTN(32 - xxe));
+  __CLC_UINTN xxe = __CLC_AS_UINTN(__clc_clz(p7)) + 1;
+  p7 = bitalign(p7, p6, (__CLC_UINTN)32u - xxe);
   __CLC_FLOATN q0 = __CLC_AS_FLOATN(
-      sign | ((127U - __CLC_AS_UINTN(xe + 23 + xxe)) << 23U) | p7 >> 9);
+      sign | ((127U - (__CLC_AS_UINTN(xe) + (__CLC_UINTN)23u + xxe)) << 23U) |
+      p7 >> 9u);
```

Which I think work out as uglier 

https://github.com/llvm/llvm-project/pull/186427
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to