| ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py UTC_ARGS: --version 6 |
| ; RUN: llc < %s -O0 -mtriple=wasm32-unknown-unknown --global-isel -disable-wasm-fallthrough-return-opt -wasm-keep-registers | FileCheck %s --check-prefixes=CHECK,WASM32 |
| ; RUN: llc < %s -O0 -mtriple=wasm64-unknown-unknown --global-isel -disable-wasm-fallthrough-return-opt -wasm-keep-registers | FileCheck %s --check-prefixes=CHECK,WASM64 |
| |
| |
| define i1 @const_i1() { |
| ; CHECK-LABEL: const_i1: |
| ; CHECK: .functype const_i1 () -> (i32) |
| ; CHECK-NEXT: # %bb.0: |
| ; CHECK-NEXT: i32.const $push0=, 1 |
| ; CHECK-NEXT: return $pop0 |
| ret i1 true |
| } |
| |
| define zeroext i8 @const_i8_zext() { |
| ; CHECK-LABEL: const_i8_zext: |
| ; CHECK: .functype const_i8_zext () -> (i32) |
| ; CHECK-NEXT: # %bb.0: |
| ; CHECK-NEXT: i32.const $push0=, 255 |
| ; CHECK-NEXT: return $pop0 |
| ret i8 255 |
| } |
| |
| define signext i8 @const_i8_sext() { |
| ; CHECK-LABEL: const_i8_sext: |
| ; CHECK: .functype const_i8_sext () -> (i32) |
| ; CHECK-NEXT: # %bb.0: |
| ; CHECK-NEXT: i32.const $push0=, -1 |
| ; CHECK-NEXT: return $pop0 |
| ret i8 255 |
| } |
| |
| define i8 @const_i8_aext() { |
| ; CHECK-LABEL: const_i8_aext: |
| ; CHECK: .functype const_i8_aext () -> (i32) |
| ; CHECK-NEXT: # %bb.0: |
| ; CHECK-NEXT: i32.const $push0=, -1 |
| ; CHECK-NEXT: return $pop0 |
| ret i8 255 |
| } |
| |
| define zeroext i16 @const_i16_zext() { |
| ; CHECK-LABEL: const_i16_zext: |
| ; CHECK: .functype const_i16_zext () -> (i32) |
| ; CHECK-NEXT: # %bb.0: |
| ; CHECK-NEXT: i32.const $push0=, 65535 |
| ; CHECK-NEXT: return $pop0 |
| ret i16 65535 |
| } |
| |
| define signext i16 @const_i16_sext() { |
| ; CHECK-LABEL: const_i16_sext: |
| ; CHECK: .functype const_i16_sext () -> (i32) |
| ; CHECK-NEXT: # %bb.0: |
| ; CHECK-NEXT: i32.const $push0=, -1 |
| ; CHECK-NEXT: return $pop0 |
| ret i16 65535 |
| } |
| |
| define i16 @const_i16_aext() { |
| ; CHECK-LABEL: const_i16_aext: |
| ; CHECK: .functype const_i16_aext () -> (i32) |
| ; CHECK-NEXT: # %bb.0: |
| ; CHECK-NEXT: i32.const $push0=, -1 |
| ; CHECK-NEXT: return $pop0 |
| ret i16 65535 |
| } |
| |
| define i32 @const_i32() { |
| ; CHECK-LABEL: const_i32: |
| ; CHECK: .functype const_i32 () -> (i32) |
| ; CHECK-NEXT: # %bb.0: |
| ; CHECK-NEXT: i32.const $push0=, -1 |
| ; CHECK-NEXT: return $pop0 |
| ret i32 4294967295 |
| } |
| |
| define i64 @const_i64() { |
| ; CHECK-LABEL: const_i64: |
| ; CHECK: .functype const_i64 () -> (i64) |
| ; CHECK-NEXT: # %bb.0: |
| ; CHECK-NEXT: i64.const $push0=, -1 |
| ; CHECK-NEXT: return $pop0 |
| ret i64 18446744073709551615 |
| } |
| |
| |
| define ptr @const_p0() { |
| ; WASM32-LABEL: const_p0: |
| ; WASM32: .functype const_p0 () -> (i32) |
| ; WASM32-NEXT: # %bb.0: |
| ; WASM32-NEXT: i32.const $push0=, 0 |
| ; WASM32-NEXT: return $pop0 |
| ; |
| ; WASM64-LABEL: const_p0: |
| ; WASM64: .functype const_p0 () -> (i64) |
| ; WASM64-NEXT: # %bb.0: |
| ; WASM64-NEXT: i64.const $push0=, 0 |
| ; WASM64-NEXT: return $pop0 |
| ret ptr null |
| } |