]> git.lizzy.rs Git - rust.git/commitdiff
Test fixes, use LLVMConstFCmp in ConstFCmp
authorCorey Richardson <corey@octayn.net>
Mon, 20 May 2013 02:08:59 +0000 (22:08 -0400)
committerCorey Richardson <corey@octayn.net>
Mon, 20 May 2013 02:09:32 +0000 (22:09 -0400)
src/librustc/lib/llvm.rs
src/test/run-pass/const-binops.rs

index bf3d09d848dadfc9cf1a391a535acf25d0d078f8..9198991e5360e7e0635df886ff1e1d6ee3a27967 100644 (file)
@@ -9,7 +9,7 @@
 // except according to those terms.
 
 use core::hashmap::HashMap;
-use core::libc::c_uint;
+use core::libc::{c_uint, c_ushort};
 
 pub type Opcode = u32;
 pub type Bool = c_uint;
@@ -221,7 +221,7 @@ pub mod llvm {
     use super::{SectionIteratorRef, TargetDataRef, TypeKind, TypeRef, UseRef};
     use super::{ValueRef};
 
-    use core::libc::{c_char, c_int, c_longlong, c_uint, c_ulonglong};
+    use core::libc::{c_char, c_int, c_longlong, c_ushort, c_uint, c_ulonglong};
 
     #[link_args = "-Lrustllvm -lrustllvm"]
     #[link_name = "rustllvm"]
@@ -452,9 +452,9 @@ pub unsafe fn LLVMSetOperand(Val: ValueRef,
         #[fast_ffi]
         pub unsafe fn LLVMConstAllOnes(Ty: TypeRef) -> ValueRef;
         #[fast_ffi]
-        pub unsafe fn LLVMConstICmp(Pred: c_uint, V1: ValueRef, V2: ValueRef) -> ValueRef;
+        pub unsafe fn LLVMConstICmp(Pred: c_ushort, V1: ValueRef, V2: ValueRef) -> ValueRef;
         #[fast_ffi]
-        pub unsafe fn LLVMConstFCmp(Pred: c_uint, V1: ValueRef, V2: ValueRef) -> ValueRef;
+        pub unsafe fn LLVMConstFCmp(Pred: c_ushort, V1: ValueRef, V2: ValueRef) -> ValueRef;
         /* only for int/vector */
         #[fast_ffi]
         pub unsafe fn LLVMGetUndef(Ty: TypeRef) -> ValueRef;
@@ -1920,12 +1920,12 @@ pub fn SetLinkage(Global: ValueRef, Link: Linkage) {
 
 pub fn ConstICmp(Pred: IntPredicate, V1: ValueRef, V2: ValueRef) -> ValueRef {
     unsafe {
-        llvm::LLVMConstICmp(Pred as c_uint, V1, V2)
+        llvm::LLVMConstICmp(Pred as c_ushort, V1, V2)
     }
 }
 pub fn ConstFCmp(Pred: RealPredicate, V1: ValueRef, V2: ValueRef) -> ValueRef {
     unsafe {
-        llvm::LLVMConstICmp(Pred as c_uint, V1, V2)
+        llvm::LLVMConstFCmp(Pred as c_ushort, V1, V2)
     }
 }
 /* Memory-managed object interface to type handles. */
index 507f68dc3a1468c2c38ae7377f3d4f6084bd88e8..cd87ca3ab537ec1eafbdae570199961fec38a69d 100644 (file)
 
 static aa: bool = 1 <= 2;
 static ab: bool = -1 <= 2;
-static ac: bool = 1.0 <= 2;
+static ac: bool = 1.0 <= 2.0;
 
 static ad: bool = 1 < 2;
 static ae: bool = -1 < 2;
-static af: bool = 1.0 < 2;
+static af: bool = 1.0 < 2.0;
 
 static ag: bool = 1 != 2;
 static ah: bool = -1 != 2;
-static ai: bool = 1.0 != 2;
+static ai: bool = 1.0 != 2.0;
 
 static aj: bool = 2 >= 1;
 static ak: bool = 2 >= -2;
-static al: bool = 1.0 >= -2;
+static al: bool = 1.0 >= -2.0;
 
 static am: bool = 2 > 1;
 static an: bool = 2 > -2;
-static ao: bool = 1.0 > -2;
+static ao: bool = 1.0 > -2.0;
 
 fn main() {
     assert_eq!(a, -1);
@@ -63,7 +63,7 @@ fn main() {
 
     assert_eq!(c, -1);
     assert_eq!(d, 0);
-    assert_approx_eq!(e, -0.3);
+    assert_approx_eq!(e, 0.3);
 
     assert_eq!(e2, -9);
     assert_eq!(f, 9);