Skip to content

Commit 808c5b8

Browse files
committed
Test fixes, use LLVMConstFCmp in ConstFCmp
1 parent b976427 commit 808c5b8

File tree

2 files changed

+12
-12
lines changed

2 files changed

+12
-12
lines changed

src/librustc/lib/llvm.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
// except according to those terms.
1010

1111
use core::hashmap::HashMap;
12-
use core::libc::c_uint;
12+
use core::libc::{c_uint, c_ushort};
1313

1414
pub type Opcode = u32;
1515
pub type Bool = c_uint;
@@ -221,7 +221,7 @@ pub mod llvm {
221221
use super::{SectionIteratorRef, TargetDataRef, TypeKind, TypeRef, UseRef};
222222
use super::{ValueRef};
223223

224-
use core::libc::{c_char, c_int, c_longlong, c_uint, c_ulonglong};
224+
use core::libc::{c_char, c_int, c_longlong, c_ushort, c_uint, c_ulonglong};
225225

226226
#[link_args = "-Lrustllvm -lrustllvm"]
227227
#[link_name = "rustllvm"]
@@ -452,9 +452,9 @@ pub mod llvm {
452452
#[fast_ffi]
453453
pub unsafe fn LLVMConstAllOnes(Ty: TypeRef) -> ValueRef;
454454
#[fast_ffi]
455-
pub unsafe fn LLVMConstICmp(Pred: c_uint, V1: ValueRef, V2: ValueRef) -> ValueRef;
455+
pub unsafe fn LLVMConstICmp(Pred: c_ushort, V1: ValueRef, V2: ValueRef) -> ValueRef;
456456
#[fast_ffi]
457-
pub unsafe fn LLVMConstFCmp(Pred: c_uint, V1: ValueRef, V2: ValueRef) -> ValueRef;
457+
pub unsafe fn LLVMConstFCmp(Pred: c_ushort, V1: ValueRef, V2: ValueRef) -> ValueRef;
458458
/* only for int/vector */
459459
#[fast_ffi]
460460
pub unsafe fn LLVMGetUndef(Ty: TypeRef) -> ValueRef;
@@ -1920,12 +1920,12 @@ pub fn SetLinkage(Global: ValueRef, Link: Linkage) {
19201920

19211921
pub fn ConstICmp(Pred: IntPredicate, V1: ValueRef, V2: ValueRef) -> ValueRef {
19221922
unsafe {
1923-
llvm::LLVMConstICmp(Pred as c_uint, V1, V2)
1923+
llvm::LLVMConstICmp(Pred as c_ushort, V1, V2)
19241924
}
19251925
}
19261926
pub fn ConstFCmp(Pred: RealPredicate, V1: ValueRef, V2: ValueRef) -> ValueRef {
19271927
unsafe {
1928-
llvm::LLVMConstICmp(Pred as c_uint, V1, V2)
1928+
llvm::LLVMConstFCmp(Pred as c_ushort, V1, V2)
19291929
}
19301930
}
19311931
/* Memory-managed object interface to type handles. */

src/test/run-pass/const-binops.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -38,23 +38,23 @@ static z: bool = 1.0 == 1.0;
3838

3939
static aa: bool = 1 <= 2;
4040
static ab: bool = -1 <= 2;
41-
static ac: bool = 1.0 <= 2;
41+
static ac: bool = 1.0 <= 2.0;
4242

4343
static ad: bool = 1 < 2;
4444
static ae: bool = -1 < 2;
45-
static af: bool = 1.0 < 2;
45+
static af: bool = 1.0 < 2.0;
4646

4747
static ag: bool = 1 != 2;
4848
static ah: bool = -1 != 2;
49-
static ai: bool = 1.0 != 2;
49+
static ai: bool = 1.0 != 2.0;
5050

5151
static aj: bool = 2 >= 1;
5252
static ak: bool = 2 >= -2;
53-
static al: bool = 1.0 >= -2;
53+
static al: bool = 1.0 >= -2.0;
5454

5555
static am: bool = 2 > 1;
5656
static an: bool = 2 > -2;
57-
static ao: bool = 1.0 > -2;
57+
static ao: bool = 1.0 > -2.0;
5858

5959
fn main() {
6060
assert_eq!(a, -1);
@@ -63,7 +63,7 @@ fn main() {
6363

6464
assert_eq!(c, -1);
6565
assert_eq!(d, 0);
66-
assert_approx_eq!(e, -0.3);
66+
assert_approx_eq!(e, 0.3);
6767

6868
assert_eq!(e2, -9);
6969
assert_eq!(f, 9);

0 commit comments

Comments
 (0)