79 lines · plain
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 %s5 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.514}15 16; CHECK-LABEL: immediate_f64:17; CHECK: f64.const $push{{[0-9]+}}=, 0x1.4p1{{$}}18define double @immediate_f64() {19 ret double 2.520}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 i3226 ret i32 %y27}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 float33 ret float %y34}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 i6440 ret i64 %y41}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 double47 ret double %y48}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 156 %tmp2 = load i64, ptr %tmp, align 857 ret i64 %tmp258}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 -166 %tmp2 = load i64, ptr %tmp, align 867 ret i64 %tmp268}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 176 %tmp2 = load i64, ptr %tmp, align 877 ret i64 %tmp278}79