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 \ 4; RUN: | FileCheck %s 5 6target triple = "wasm32-unknown-unknown" 7 8; This tests very minimal fast-isel functionality. 9 10; CHECK-LABEL: immediate_f32: 11; CHECK: f32.const $push{{[0-9]+}}=, 0x1.4p1{{$}} 12define float @immediate_f32() { 13 ret float 2.5 14} 15 16; CHECK-LABEL: immediate_f64: 17; CHECK: f64.const $push{{[0-9]+}}=, 0x1.4p1{{$}} 18define double @immediate_f64() { 19 ret double 2.5 20} 21 22; CHECK-LABEL: bitcast_i32_f32: 23; CHECK: i32.reinterpret_f32 $push{{[0-9]+}}=, $0{{$}} 24define i32 @bitcast_i32_f32(float %x) { 25 %y = bitcast float %x to i32 26 ret i32 %y 27} 28 29; CHECK-LABEL: bitcast_f32_i32: 30; CHECK: f32.reinterpret_i32 $push{{[0-9]+}}=, $0{{$}} 31define float @bitcast_f32_i32(i32 %x) { 32 %y = bitcast i32 %x to float 33 ret float %y 34} 35 36; CHECK-LABEL: bitcast_i64_f64: 37; CHECK: i64.reinterpret_f64 $push{{[0-9]+}}=, $0{{$}} 38define i64 @bitcast_i64_f64(double %x) { 39 %y = bitcast double %x to i64 40 ret i64 %y 41} 42 43; CHECK-LABEL: bitcast_f64_i64: 44; CHECK: f64.reinterpret_i64 $push{{[0-9]+}}=, $0{{$}} 45define double @bitcast_f64_i64(i64 %x) { 46 %y = bitcast i64 %x to double 47 ret double %y 48} 49 50; Do fold offsets into geps. 51; CHECK-LABEL: do_fold_offset_into_gep: 52; CHECK: i64.load $push{{[0-9]+}}=, 8($0) 53define i64 @do_fold_offset_into_gep(ptr %p) { 54bb: 55 %tmp = getelementptr inbounds i64, ptr %p, i32 1 56 %tmp2 = load i64, ptr %tmp, align 8 57 ret i64 %tmp2 58} 59 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]+}}) 63define i64 @dont_fold_negative_offset(ptr %p) { 64bb: 65 %tmp = getelementptr inbounds i64, ptr %p, i32 -1 66 %tmp2 = load i64, ptr %tmp, align 8 67 ret i64 %tmp2 68} 69 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]+}}) 73define i64 @dont_fold_non_inbounds_gep(ptr %p) { 74bb: 75 %tmp = getelementptr i64, ptr %p, i32 1 76 %tmp2 = load i64, ptr %tmp, align 8 77 ret i64 %tmp2 78} 79