Fix issue #2: use zero extend to convert bool->int, not sign extend.
This way, we match C/C++ in that casting a bool to an int gives either the value zero or the value one. There is a new stdlib function int sign_extend(bool) that does sign extension for cases where that's desired.
This commit is contained in:
11
stdlib.m4
11
stdlib.m4
@@ -644,6 +644,17 @@ define internal float @__undef_uniform() nounwind readnone alwaysinline {
|
||||
ret float undef
|
||||
}
|
||||
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
;; sign extension
|
||||
|
||||
define internal i32 @__sext_uniform_bool(i1) nounwind readnone alwaysinline {
|
||||
%r = sext i1 %0 to i32
|
||||
ret i32 %r
|
||||
}
|
||||
|
||||
define internal <$1 x i32> @__sext_varying_bool(<$1 x i32>) nounwind readnone alwaysinline {
|
||||
ret <$1 x i32> %0
|
||||
}
|
||||
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
;; stdlib transcendentals
|
||||
|
||||
Reference in New Issue
Block a user