diff options
author | Chris Lattner <sabre@nondot.org> | 2008-01-08 06:46:30 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2008-01-08 06:46:30 +0000 |
commit | fe39edde27147d4645aff715d5a7630fa07fa885 (patch) | |
tree | 2e005cf02279057eeced3697defcd955c706de7b /lib/Target/PowerPC/README.txt | |
parent | 83d760ba8eebc0a524cd9b1157eb3b4b151a5aef (diff) |
Finally implement correct ordered comparisons for PPC, even though
the code generated is not wonderful. This turns a miscompilation into
a code quality bug (noted in the ppc readme). This fixes PR642, which
is over 2 years old (!). Nate, please review this.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@45742 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Target/PowerPC/README.txt')
-rw-r--r-- | lib/Target/PowerPC/README.txt | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/lib/Target/PowerPC/README.txt b/lib/Target/PowerPC/README.txt index 74bd15038a..a6034e1fa9 100644 --- a/lib/Target/PowerPC/README.txt +++ b/lib/Target/PowerPC/README.txt @@ -706,3 +706,32 @@ __Z11no_overflowjj: //===---------------------------------------------------------------------===// +We compile some FP comparisons into an mfcr with two rlwinms and an or. For +example: +#include <math.h> +int test(double x, double y) { return islessequal(x, y);} +int test2(double x, double y) { return islessgreater(x, y);} +int test3(double x, double y) { return !islessequal(x, y);} + +Compiles into (all three are similar, but the bits differ): + +_test: + fcmpu cr7, f1, f2 + mfcr r2 + rlwinm r3, r2, 29, 31, 31 + rlwinm r2, r2, 31, 31, 31 + or r3, r2, r3 + blr + +GCC compiles this into: + + _test: + fcmpu cr7,f1,f2 + cror 30,28,30 + mfcr r3 + rlwinm r3,r3,31,1 + blr + +which is more efficient and can use mfocr. See PR642 for some more context. + +//===---------------------------------------------------------------------===// |