[llvm-commits] CVS: llvm-gcc/gcc/llvm-expand.c

Chris Lattner lattner at cs.uiuc.edu
Fri Jun 18 22:43:02 PDT 2004


Changes in directory llvm-gcc/gcc:

llvm-expand.c updated: 1.43 -> 1.44

---
Log message:

Fix bug in expansion of unordered comparisons.  The GCC UNLT_EXPR operation
corresponds to (X < Y || isunordered(X, Y)), whereas C99's islessthan 
is really (X < Y && !isunordered(X, Y)).  I thought that GCC followed the
C99 semantics: oops.


---
Diffs of the changes:  (+2 -4)

Index: llvm-gcc/gcc/llvm-expand.c
diff -u llvm-gcc/gcc/llvm-expand.c:1.43 llvm-gcc/gcc/llvm-expand.c:1.44
--- llvm-gcc/gcc/llvm-expand.c:1.43	Fri Jun 18 19:49:13 2004
+++ llvm-gcc/gcc/llvm-expand.c	Fri Jun 18 22:35:20 2004
@@ -6265,12 +6265,10 @@
       }
     }
 
-    /* If this is an unordered comparison, 'and` in !isunordered(X, Y). */
+    /* If this is an unordered comparison, 'or' in isunordered(X, Y). */
     if (isUnordered) {
       llvm_value *Tmp = append_llvm_isunordered_call(Fn, op0, op1);
-      Tmp = append_inst(Fn, create_binary_inst("tmp", O_Xor, Tmp,
-                                               llvm_constant_bool_true));
-      Result = append_inst(Fn, create_binary_inst("tmp", O_And, Tmp, Result));
+      Result = append_inst(Fn, create_binary_inst("tmp", O_Or, Tmp, Result));
     }
 
     break;





More information about the llvm-commits mailing list