Skip to content

Commit

Permalink
Test fixes, use LLVMConstFCmp in ConstFCmp
Browse files Browse the repository at this point in the history
  • Loading branch information
emberian committed May 20, 2013
1 parent b976427 commit 808c5b8
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 12 deletions.
12 changes: 6 additions & 6 deletions src/librustc/lib/llvm.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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"]
Expand Down Expand Up @@ -452,9 +452,9 @@ pub mod llvm {
#[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;
Expand Down Expand Up @@ -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. */
Expand Down
12 changes: 6 additions & 6 deletions src/test/run-pass/const-binops.rs
Original file line number Diff line number Diff line change
Expand Up @@ -38,23 +38,23 @@ static z: bool = 1.0 == 1.0;

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);
Expand All @@ -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);
Expand Down

5 comments on commit 808c5b8

@bors
Copy link
Contributor

@bors bors commented on 808c5b8 May 20, 2013

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@bors
Copy link
Contributor

@bors bors commented on 808c5b8 May 20, 2013

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

merging cmr/rust/constops = 808c5b8 into auto

@bors
Copy link
Contributor

@bors bors commented on 808c5b8 May 20, 2013

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

cmr/rust/constops = 808c5b8 merged ok, testing candidate = cab9249

@bors
Copy link
Contributor

@bors bors commented on 808c5b8 May 20, 2013

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@bors
Copy link
Contributor

@bors bors commented on 808c5b8 May 20, 2013

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fast-forwarding incoming to auto = cab9249

Please sign in to comment.