1 ; RUN: llc < %s -asm-verbose=false \
2 ; RUN: -fast-isel -fast-isel-abort=1 -verify-machineinstrs \
3 ; RUN: -wasm-disable-explicit-locals -wasm-keep-registers \
6 target triple = "wasm32-unknown-unknown"
8 ; This tests very minimal fast-isel functionality.
10 ; CHECK-LABEL: immediate_f32:
11 ; CHECK: f32.const $push{{[0-9]+}}=, 0x1.4p1{{$}}
12 define float @immediate_f32() {
16 ; CHECK-LABEL: immediate_f64:
17 ; CHECK: f64.const $push{{[0-9]+}}=, 0x1.4p1{{$}}
18 define double @immediate_f64() {
22 ; CHECK-LABEL: bitcast_i32_f32:
23 ; CHECK: i32.reinterpret_f32 $push{{[0-9]+}}=, $0{{$}}
24 define i32 @bitcast_i32_f32(float %x) {
25 %y = bitcast float %x to i32
29 ; CHECK-LABEL: bitcast_f32_i32:
30 ; CHECK: f32.reinterpret_i32 $push{{[0-9]+}}=, $0{{$}}
31 define float @bitcast_f32_i32(i32 %x) {
32 %y = bitcast i32 %x to float
36 ; CHECK-LABEL: bitcast_i64_f64:
37 ; CHECK: i64.reinterpret_f64 $push{{[0-9]+}}=, $0{{$}}
38 define i64 @bitcast_i64_f64(double %x) {
39 %y = bitcast double %x to i64
43 ; CHECK-LABEL: bitcast_f64_i64:
44 ; CHECK: f64.reinterpret_i64 $push{{[0-9]+}}=, $0{{$}}
45 define double @bitcast_f64_i64(i64 %x) {
46 %y = bitcast i64 %x to double
50 ; Do fold offsets into geps.
51 ; CHECK-LABEL: do_fold_offset_into_gep:
52 ; CHECK: i64.load $push{{[0-9]+}}=, 8($0)
53 define i64 @do_fold_offset_into_gep(ptr %p) {
55 %tmp = getelementptr inbounds i64, ptr %p, i32 1
56 %tmp2 = load i64, ptr %tmp, align 8
60 ; Don't fold negative offsets into geps.
61 ; CHECK-LABEL: dont_fold_negative_offset:
62 ; CHECK: i64.load $push{{[0-9]+}}=, 0($pop{{[0-9]+}})
63 define i64 @dont_fold_negative_offset(ptr %p) {
65 %tmp = getelementptr inbounds i64, ptr %p, i32 -1
66 %tmp2 = load i64, ptr %tmp, align 8
70 ; Don't fold non-inbounds geps.
71 ; CHECK-LABEL: dont_fold_non_inbounds_gep:
72 ; CHECK: i64.load $push{{[0-9]+}}=, 0($pop{{[0-9]+}})
73 define i64 @dont_fold_non_inbounds_gep(ptr %p) {
75 %tmp = getelementptr i64, ptr %p, i32 1
76 %tmp2 = load i64, ptr %tmp, align 8