================ @@ -307,8 +320,8 @@ def generate_saturated_conversion(src, dst, size): # Conversion from float to int print( """ {DST}{N} y = convert_{DST}{N}(x); - y = select(y, ({DST}{N}){DST_MIN}, {BP}(x < ({SRC}{N}){DST_MIN}){BS}); - y = select(y, ({DST}{N}){DST_MAX}, {BP}(x > ({SRC}{N}){DST_MAX}){BS}); + y = select(y, ({DST}{N}){DST_MIN}, {BP}(x <= ({SRC}{N}){DST_MIN}){BS}); + y = select(y, ({DST}{N}){DST_MAX}, {BP}(x >= ({SRC}{N}){DST_MAX}){BS}); ---------------- rjodinchr wrote:
Yes this change was intended. It is not a standalone bugfix as for all C platforms, this should be the same. But with Vulkan SPIR-V it leads to issues with zeros, infs & nans, where comparisons are unspecified (if I remember correctly). I understand that changing the default path might get a bit more dangerous there, so I have added a if statement for it as well. https://github.com/llvm/llvm-project/pull/66902 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits