| ; 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-prefix=WASM32 |
| ; RUN: llc < %s -O0 -mtriple=wasm64-unknown-unknown --global-isel -disable-wasm-fallthrough-return-opt -wasm-keep-registers | FileCheck %s --check-prefix=WASM64 |
| |
| define i8 @ptrtoint_i8(ptr %x) { |
| ; WASM32-LABEL: ptrtoint_i8: |
| ; WASM32: .functype ptrtoint_i8 (i32) -> (i32) |
| ; WASM32-NEXT: # %bb.0: |
| ; WASM32-NEXT: local.get $push0=, 0 |
| ; WASM32-NEXT: return $pop0 |
| ; |
| ; WASM64-LABEL: ptrtoint_i8: |
| ; WASM64: .functype ptrtoint_i8 (i64) -> (i32) |
| ; WASM64-NEXT: # %bb.0: |
| ; WASM64-NEXT: local.get $push1=, 0 |
| ; WASM64-NEXT: i32.wrap_i64 $push0=, $pop1 |
| ; WASM64-NEXT: return $pop0 |
| %a = ptrtoint ptr %x to i8 |
| ret i8 %a |
| } |
| |
| define i16 @ptrtoint_i16(ptr %x) { |
| ; WASM32-LABEL: ptrtoint_i16: |
| ; WASM32: .functype ptrtoint_i16 (i32) -> (i32) |
| ; WASM32-NEXT: # %bb.0: |
| ; WASM32-NEXT: local.get $push0=, 0 |
| ; WASM32-NEXT: return $pop0 |
| ; |
| ; WASM64-LABEL: ptrtoint_i16: |
| ; WASM64: .functype ptrtoint_i16 (i64) -> (i32) |
| ; WASM64-NEXT: # %bb.0: |
| ; WASM64-NEXT: local.get $push1=, 0 |
| ; WASM64-NEXT: i32.wrap_i64 $push0=, $pop1 |
| ; WASM64-NEXT: return $pop0 |
| %a = ptrtoint ptr %x to i16 |
| ret i16 %a |
| } |
| |
| define i32 @ptrtoint_i32(ptr %x) { |
| ; WASM32-LABEL: ptrtoint_i32: |
| ; WASM32: .functype ptrtoint_i32 (i32) -> (i32) |
| ; WASM32-NEXT: # %bb.0: |
| ; WASM32-NEXT: local.get $push0=, 0 |
| ; WASM32-NEXT: return $pop0 |
| ; |
| ; WASM64-LABEL: ptrtoint_i32: |
| ; WASM64: .functype ptrtoint_i32 (i64) -> (i32) |
| ; WASM64-NEXT: # %bb.0: |
| ; WASM64-NEXT: local.get $push1=, 0 |
| ; WASM64-NEXT: i32.wrap_i64 $push0=, $pop1 |
| ; WASM64-NEXT: return $pop0 |
| %a = ptrtoint ptr %x to i32 |
| ret i32 %a |
| } |
| |
| define i64 @ptrtoint_i64(ptr %x) { |
| ; WASM32-LABEL: ptrtoint_i64: |
| ; WASM32: .functype ptrtoint_i64 (i32) -> (i64) |
| ; WASM32-NEXT: # %bb.0: |
| ; WASM32-NEXT: local.get $push1=, 0 |
| ; WASM32-NEXT: i64.extend_i32_u $push0=, $pop1 |
| ; WASM32-NEXT: return $pop0 |
| ; |
| ; WASM64-LABEL: ptrtoint_i64: |
| ; WASM64: .functype ptrtoint_i64 (i64) -> (i64) |
| ; WASM64-NEXT: # %bb.0: |
| ; WASM64-NEXT: local.get $push0=, 0 |
| ; WASM64-NEXT: return $pop0 |
| %a = ptrtoint ptr %x to i64 |
| ret i64 %a |
| } |