-
Notifications
You must be signed in to change notification settings - Fork 100
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
As mentioned in https://reviews.llvm.org/D106053#2885236 , Alive2 had a bug in fptoui/si encoding. `fptoui float 31.5 to i32' was yielding poison because np was `(float)(i32)31.5 == 31.5' which is alway false. The rhs is fixed to round towards zero so that it becomes `(float)(i32)31.5 == round_towards_zero(31.5)'. Also, fptoui should round towards zero according to LangRef, but it was using nearest ties to even. This is fixed as well.
- Loading branch information
Showing
5 changed files
with
35 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
define i32 @src() { | ||
%v = fptosi float 31.5 to i32 | ||
ret i32 %v | ||
} | ||
|
||
define i32 @tgt() { | ||
ret i32 poison | ||
} | ||
|
||
; ERROR: Target is more poisonous than source |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
; https://reviews.llvm.org/D106053#2885236 | ||
|
||
define i32 @src() { | ||
%v = fptoui float 31.5 to i32 | ||
ret i32 %v | ||
} | ||
|
||
define i32 @tgt() { | ||
ret i32 poison | ||
} | ||
|
||
; ERROR: Target is more poisonous than source |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
; fptoui does rounding towards zero conversion when it ties | ||
|
||
define i32 @src() { | ||
%v = fptoui float 31.5 to i32 | ||
ret i32 %v | ||
} | ||
|
||
define i32 @tgt() { | ||
ret i32 31 | ||
} |