Home | History | Annotate | Download | only in WebAssembly
      1 ; RUN: llc < %s -asm-verbose=false -disable-wasm-fallthrough-return-opt -verify-machineinstrs | FileCheck %s
      2 ; RUN: llc < %s -asm-verbose=false -fast-isel -verify-machineinstrs | FileCheck %s
      3 
      4 ; Test that FastISel does not generate instructions with NoReg
      5 
      6 target datalayout = "e-m:e-p:32:32-i64:64-n32:64-S128"
      7 target triple = "wasm32-unknown-unknown"
      8 
      9 ; CHECK: i32.const $push0=, 0
     10 define hidden i32 @a() #0 {
     11 entry:
     12   ret i32 zext (i1 icmp eq (void (...)* inttoptr (i32 10 to void (...)*), void (...)* null) to i32)
     13 }
     14 
     15 ; CHECK: i32.const $push0=, 1
     16 ; CHECK: br_if 0, $pop0
     17 define hidden i32 @b() #0 {
     18 entry:
     19   br i1 icmp eq (void (...)* inttoptr (i32 10 to void (...)*), void (...)* null), label %a, label %b
     20 a:
     21   unreachable
     22 b:
     23   ret i32 0
     24 }
     25 
     26 ; CHECK: i32.const $push1=, 0
     27 ; CHECK: i32.const $push2=, 0
     28 ; CHECK: i32.store 0($pop1), $pop2
     29 define hidden i32 @c() #0 {
     30 entry:
     31   store i32 zext (i1 icmp eq (void (...)* inttoptr (i32 10 to void (...)*), void (...)* null) to i32), i32* inttoptr (i32 0 to i32 *)
     32   ret i32 0
     33 }
     34 
     35 ; CHECK: i32.const {{.*}}, addr@FUNCTION
     36 ; CHECK: i32.const {{.*}}, 24
     37 ; CHECK: i32.shl
     38 ; CHECK: i32.const {{.*}}, 24
     39 ; CHECK: i32.shr_s
     40 ; CHECK: i32.const {{.*}}, 64
     41 ; CHECK: br_if 0, $pop0
     42 define hidden i32 @d() #0 {
     43 entry:
     44   %t = icmp slt i8 ptrtoint (void ()* @addr to i8), 64
     45   br i1 %t, label %a, label %b
     46 a:
     47   unreachable
     48 b:
     49   ret i32 0
     50 }
     51 
     52 ; CHECK: i32.const {{.*}}, addr@FUNCTION
     53 ; CHECK: i32.const {{.*}}, 255
     54 ; CHECK: i32.and
     55 ; CHECK: i32.const {{.*}}, 64
     56 ; CHECK: br_if 0, $pop0
     57 define hidden i32 @e() #0 {
     58 entry:
     59   %t = icmp ult i8 ptrtoint (void ()* @addr to i8), 64
     60   br i1 %t, label %a, label %b
     61 a:
     62   unreachable
     63 b:
     64   ret i32 0
     65 }
     66 
     67 ; CHECK: i32.const {{.*}}, addr@FUNCTION
     68 ; CHECK: i32.const {{.*}}, 24
     69 ; CHECK: i32.shl
     70 ; CHECK: i32.const {{.*}}, 24
     71 ; CHECK: i32.shr_s
     72 define hidden i32 @f() #0 {
     73 entry:
     74   %t = sext i8 ptrtoint (void ()* @addr to i8) to i32
     75   ret i32 %t
     76 }
     77 
     78 ; CHECK: i32.const {{.*}}, addr@FUNCTION
     79 ; CHECK: i32.const {{.*}}, 255
     80 ; CHECK: i32.and
     81 define hidden i32 @g() #0 {
     82 entry:
     83   %t = zext i8 ptrtoint (void ()* @addr to i8) to i32
     84   ret i32 %t
     85 }
     86 
     87 declare void @addr()
     88 
     89 attributes #0 = { noinline optnone }
     90