2015-08-12 05:02:46 +08:00
|
|
|
; RUN: llc < %s -asm-verbose=false | FileCheck %s
|
|
|
|
|
|
|
|
; Test that basic 32-bit integer comparison operations assemble as expected.
|
|
|
|
|
|
|
|
target datalayout = "e-p:32:32-i64:64-v128:8:128-n32:64-S128"
|
|
|
|
target triple = "wasm32-unknown-unknown"
|
|
|
|
|
|
|
|
; CHECK-LABEL: eq_i32:
|
|
|
|
; CHECK-NEXT: (setlocal @0 (argument 1))
|
|
|
|
; CHECK-NEXT: (setlocal @1 (argument 0))
|
|
|
|
; CHECK-NEXT: (setlocal @2 (eq @1 @0))
|
2015-08-13 01:53:29 +08:00
|
|
|
; CHECK-NEXT: (return @2)
|
2015-08-12 05:02:46 +08:00
|
|
|
define i32 @eq_i32(i32 %x, i32 %y) {
|
|
|
|
%a = icmp eq i32 %x, %y
|
|
|
|
%b = zext i1 %a to i32
|
|
|
|
ret i32 %b
|
|
|
|
}
|
|
|
|
|
|
|
|
; CHECK-LABEL: ne_i32:
|
|
|
|
; CHECK: (setlocal @2 (ne @1 @0))
|
|
|
|
define i32 @ne_i32(i32 %x, i32 %y) {
|
|
|
|
%a = icmp ne i32 %x, %y
|
|
|
|
%b = zext i1 %a to i32
|
|
|
|
ret i32 %b
|
|
|
|
}
|
|
|
|
|
|
|
|
; CHECK-LABEL: slt_i32:
|
|
|
|
; CHECK: (setlocal @2 (slt @1 @0))
|
|
|
|
define i32 @slt_i32(i32 %x, i32 %y) {
|
|
|
|
%a = icmp slt i32 %x, %y
|
|
|
|
%b = zext i1 %a to i32
|
|
|
|
ret i32 %b
|
|
|
|
}
|
|
|
|
|
|
|
|
; CHECK-LABEL: sle_i32:
|
|
|
|
; CHECK: (setlocal @2 (sle @1 @0))
|
|
|
|
define i32 @sle_i32(i32 %x, i32 %y) {
|
|
|
|
%a = icmp sle i32 %x, %y
|
|
|
|
%b = zext i1 %a to i32
|
|
|
|
ret i32 %b
|
|
|
|
}
|
|
|
|
|
|
|
|
; CHECK-LABEL: ult_i32:
|
|
|
|
; CHECK: (setlocal @2 (ult @1 @0))
|
|
|
|
define i32 @ult_i32(i32 %x, i32 %y) {
|
|
|
|
%a = icmp ult i32 %x, %y
|
|
|
|
%b = zext i1 %a to i32
|
|
|
|
ret i32 %b
|
|
|
|
}
|
|
|
|
|
|
|
|
; CHECK-LABEL: ule_i32:
|
|
|
|
; CHECK: (setlocal @2 (ule @1 @0))
|
|
|
|
define i32 @ule_i32(i32 %x, i32 %y) {
|
|
|
|
%a = icmp ule i32 %x, %y
|
|
|
|
%b = zext i1 %a to i32
|
|
|
|
ret i32 %b
|
|
|
|
}
|
|
|
|
|
|
|
|
; CHECK-LABEL: sgt_i32:
|
|
|
|
; CHECK: (setlocal @2 (sgt @1 @0))
|
|
|
|
define i32 @sgt_i32(i32 %x, i32 %y) {
|
|
|
|
%a = icmp sgt i32 %x, %y
|
|
|
|
%b = zext i1 %a to i32
|
|
|
|
ret i32 %b
|
|
|
|
}
|
|
|
|
|
|
|
|
; CHECK-LABEL: sge_i32:
|
|
|
|
; CHECK: (setlocal @2 (sge @1 @0))
|
|
|
|
define i32 @sge_i32(i32 %x, i32 %y) {
|
|
|
|
%a = icmp sge i32 %x, %y
|
|
|
|
%b = zext i1 %a to i32
|
|
|
|
ret i32 %b
|
|
|
|
}
|
|
|
|
|
|
|
|
; CHECK-LABEL: ugt_i32:
|
|
|
|
; CHECK: (setlocal @2 (ugt @1 @0))
|
|
|
|
define i32 @ugt_i32(i32 %x, i32 %y) {
|
|
|
|
%a = icmp ugt i32 %x, %y
|
|
|
|
%b = zext i1 %a to i32
|
|
|
|
ret i32 %b
|
|
|
|
}
|
|
|
|
|
|
|
|
; CHECK-LABEL: uge_i32:
|
|
|
|
; CHECK: (setlocal @2 (uge @1 @0))
|
|
|
|
define i32 @uge_i32(i32 %x, i32 %y) {
|
|
|
|
%a = icmp uge i32 %x, %y
|
|
|
|
%b = zext i1 %a to i32
|
|
|
|
ret i32 %b
|
|
|
|
}
|