Home | History | Annotate | Download | only in WebAssembly
      1 ; RUN: llc < %s -asm-verbose=false | FileCheck %s
      2 
      3 ; Test that basic 64-bit integer comparison operations assemble as expected.
      4 
      5 target datalayout = "e-p:32:32-i64:64-n32:64-S128"
      6 target triple = "wasm32-unknown-unknown"
      7 
      8 ; CHECK-LABEL: eq_i64:
      9 ; CHECK-NEXT: .param i64, i64{{$}}
     10 ; CHECK-NEXT: .result i32{{$}}
     11 ; CHECK-NEXT: i64.eq $push[[NUM:[0-9]+]]=, $0, $1{{$}}
     12 ; CHECK-NEXT: return $pop[[NUM]]{{$}}
     13 define i32 @eq_i64(i64 %x, i64 %y) {
     14   %a = icmp eq i64 %x, %y
     15   %b = zext i1 %a to i32
     16   ret i32 %b
     17 }
     18 
     19 ; CHECK-LABEL: ne_i64:
     20 ; CHECK: i64.ne $push[[NUM:[0-9]+]]=, $0, $1{{$}}
     21 ; CHECK-NEXT: return $pop[[NUM]]{{$}}
     22 define i32 @ne_i64(i64 %x, i64 %y) {
     23   %a = icmp ne i64 %x, %y
     24   %b = zext i1 %a to i32
     25   ret i32 %b
     26 }
     27 
     28 ; CHECK-LABEL: slt_i64:
     29 ; CHECK: i64.lt_s $push[[NUM:[0-9]+]]=, $0, $1{{$}}
     30 ; CHECK-NEXT: return $pop[[NUM]]{{$}}
     31 define i32 @slt_i64(i64 %x, i64 %y) {
     32   %a = icmp slt i64 %x, %y
     33   %b = zext i1 %a to i32
     34   ret i32 %b
     35 }
     36 
     37 ; CHECK-LABEL: sle_i64:
     38 ; CHECK: i64.le_s $push[[NUM:[0-9]+]]=, $0, $1{{$}}
     39 ; CHECK-NEXT: return $pop[[NUM]]{{$}}
     40 define i32 @sle_i64(i64 %x, i64 %y) {
     41   %a = icmp sle i64 %x, %y
     42   %b = zext i1 %a to i32
     43   ret i32 %b
     44 }
     45 
     46 ; CHECK-LABEL: ult_i64:
     47 ; CHECK: i64.lt_u $push[[NUM:[0-9]+]]=, $0, $1{{$}}
     48 ; CHECK-NEXT: return $pop[[NUM]]{{$}}
     49 define i32 @ult_i64(i64 %x, i64 %y) {
     50   %a = icmp ult i64 %x, %y
     51   %b = zext i1 %a to i32
     52   ret i32 %b
     53 }
     54 
     55 ; CHECK-LABEL: ule_i64:
     56 ; CHECK: i64.le_u $push[[NUM:[0-9]+]]=, $0, $1{{$}}
     57 ; CHECK-NEXT: return $pop[[NUM]]{{$}}
     58 define i32 @ule_i64(i64 %x, i64 %y) {
     59   %a = icmp ule i64 %x, %y
     60   %b = zext i1 %a to i32
     61   ret i32 %b
     62 }
     63 
     64 ; CHECK-LABEL: sgt_i64:
     65 ; CHECK: i64.gt_s $push[[NUM:[0-9]+]]=, $0, $1{{$}}
     66 ; CHECK-NEXT: return $pop[[NUM]]{{$}}
     67 define i32 @sgt_i64(i64 %x, i64 %y) {
     68   %a = icmp sgt i64 %x, %y
     69   %b = zext i1 %a to i32
     70   ret i32 %b
     71 }
     72 
     73 ; CHECK-LABEL: sge_i64:
     74 ; CHECK: i64.ge_s $push[[NUM:[0-9]+]]=, $0, $1{{$}}
     75 ; CHECK-NEXT: return $pop[[NUM]]{{$}}
     76 define i32 @sge_i64(i64 %x, i64 %y) {
     77   %a = icmp sge i64 %x, %y
     78   %b = zext i1 %a to i32
     79   ret i32 %b
     80 }
     81 
     82 ; CHECK-LABEL: ugt_i64:
     83 ; CHECK: i64.gt_u $push[[NUM:[0-9]+]]=, $0, $1{{$}}
     84 ; CHECK-NEXT: return $pop[[NUM]]{{$}}
     85 define i32 @ugt_i64(i64 %x, i64 %y) {
     86   %a = icmp ugt i64 %x, %y
     87   %b = zext i1 %a to i32
     88   ret i32 %b
     89 }
     90 
     91 ; CHECK-LABEL: uge_i64:
     92 ; CHECK: i64.ge_u $push[[NUM:[0-9]+]]=, $0, $1{{$}}
     93 ; CHECK-NEXT: return $pop[[NUM]]{{$}}
     94 define i32 @uge_i64(i64 %x, i64 %y) {
     95   %a = icmp uge i64 %x, %y
     96   %b = zext i1 %a to i32
     97   ret i32 %b
     98 }
     99