Thomas Lively | b6dac89 | 2018-12-21 06:58:15 +0000 | [diff] [blame] | 1 | ; RUN: llc < %s -asm-verbose=false -verify-machineinstrs -wasm-keep-registers -disable-wasm-fallthrough-return-opt -wasm-disable-explicit-locals -wasm-enable-unimplemented-simd -mattr=+simd128,+sign-ext | FileCheck %s --check-prefixes CHECK,SIMD128 |
| 2 | ; RUN: llc < %s -asm-verbose=false -verify-machineinstrs -wasm-keep-registers -disable-wasm-fallthrough-return-opt -wasm-disable-explicit-locals -mattr=+simd128,+sign-ext | FileCheck %s --check-prefixes CHECK,SIMD128-VM |
| 3 | ; RUN: llc < %s -asm-verbose=false -verify-machineinstrs -wasm-keep-registers -disable-wasm-fallthrough-return-opt -wasm-disable-explicit-locals -mattr=-simd128,+sign-ext | FileCheck %s --check-prefixes CHECK,NO-SIMD128 |
Thomas Lively | c949857 | 2018-09-26 00:34:36 +0000 | [diff] [blame] | 4 | |
| 5 | ; Test that vector float-to-int and int-to-float instructions lower correctly |
| 6 | |
| 7 | target datalayout = "e-m:e-p:32:32-i64:64-n32:64-S128" |
| 8 | target triple = "wasm32-unknown-unknown" |
| 9 | |
| 10 | ; CHECK-LABEL: convert_s_v4f32: |
| 11 | ; NO-SIMD128-NOT: i32x4 |
Wouter van Oortmerssen | 49482f8 | 2018-11-19 17:10:36 +0000 | [diff] [blame] | 12 | ; SIMD128-NEXT: .functype convert_s_v4f32 (v128) -> (v128){{$}} |
Thomas Lively | 6f77811 | 2018-10-02 01:52:21 +0000 | [diff] [blame] | 13 | ; SIMD128-NEXT: f32x4.convert_s/i32x4 $push[[R:[0-9]+]]=, $0 |
Thomas Lively | c949857 | 2018-09-26 00:34:36 +0000 | [diff] [blame] | 14 | ; SIMD128-NEXT: return $pop[[R]] |
| 15 | define <4 x float> @convert_s_v4f32(<4 x i32> %x) { |
| 16 | %a = sitofp <4 x i32> %x to <4 x float> |
| 17 | ret <4 x float> %a |
| 18 | } |
| 19 | |
| 20 | ; CHECK-LABEL: convert_u_v4f32: |
| 21 | ; NO-SIMD128-NOT: i32x4 |
Wouter van Oortmerssen | 49482f8 | 2018-11-19 17:10:36 +0000 | [diff] [blame] | 22 | ; SIMD128-NEXT: .functype convert_u_v4f32 (v128) -> (v128){{$}} |
Thomas Lively | 6f77811 | 2018-10-02 01:52:21 +0000 | [diff] [blame] | 23 | ; SIMD128-NEXT: f32x4.convert_u/i32x4 $push[[R:[0-9]+]]=, $0 |
Thomas Lively | c949857 | 2018-09-26 00:34:36 +0000 | [diff] [blame] | 24 | ; SIMD128-NEXT: return $pop[[R]] |
| 25 | define <4 x float> @convert_u_v4f32(<4 x i32> %x) { |
| 26 | %a = uitofp <4 x i32> %x to <4 x float> |
| 27 | ret <4 x float> %a |
| 28 | } |
| 29 | |
| 30 | ; CHECK-LABEL: convert_s_v2f64: |
| 31 | ; NO-SIMD128-NOT: i64x2 |
Thomas Lively | 6f77811 | 2018-10-02 01:52:21 +0000 | [diff] [blame] | 32 | ; SIMD128-VM-NOT: f64x2.convert_s/i64x2 |
Wouter van Oortmerssen | 49482f8 | 2018-11-19 17:10:36 +0000 | [diff] [blame] | 33 | ; SIMD128-NEXT: .functype convert_s_v2f64 (v128) -> (v128){{$}} |
Thomas Lively | 6f77811 | 2018-10-02 01:52:21 +0000 | [diff] [blame] | 34 | ; SIMD128-NEXT: f64x2.convert_s/i64x2 $push[[R:[0-9]+]]=, $0 |
Thomas Lively | c949857 | 2018-09-26 00:34:36 +0000 | [diff] [blame] | 35 | ; SIMD128-NEXT: return $pop[[R]] |
| 36 | define <2 x double> @convert_s_v2f64(<2 x i64> %x) { |
| 37 | %a = sitofp <2 x i64> %x to <2 x double> |
| 38 | ret <2 x double> %a |
| 39 | } |
| 40 | |
| 41 | ; CHECK-LABEL: convert_u_v2f64: |
| 42 | ; NO-SIMD128-NOT: i64x2 |
Thomas Lively | 6f77811 | 2018-10-02 01:52:21 +0000 | [diff] [blame] | 43 | ; SIMD128-VM-NOT: f64x2.convert_u/i64x2 |
Wouter van Oortmerssen | 49482f8 | 2018-11-19 17:10:36 +0000 | [diff] [blame] | 44 | ; SIMD128-NEXT: .functype convert_u_v2f64 (v128) -> (v128){{$}} |
Thomas Lively | 6f77811 | 2018-10-02 01:52:21 +0000 | [diff] [blame] | 45 | ; SIMD128-NEXT: f64x2.convert_u/i64x2 $push[[R:[0-9]+]]=, $0 |
Thomas Lively | c949857 | 2018-09-26 00:34:36 +0000 | [diff] [blame] | 46 | ; SIMD128-NEXT: return $pop[[R]] |
| 47 | define <2 x double> @convert_u_v2f64(<2 x i64> %x) { |
| 48 | %a = uitofp <2 x i64> %x to <2 x double> |
| 49 | ret <2 x double> %a |
| 50 | } |
| 51 | |
Thomas Lively | 6f77811 | 2018-10-02 01:52:21 +0000 | [diff] [blame] | 52 | ; CHECK-LABEL: trunc_sat_s_v4i32: |
Thomas Lively | c949857 | 2018-09-26 00:34:36 +0000 | [diff] [blame] | 53 | ; NO-SIMD128-NOT: f32x4 |
Wouter van Oortmerssen | 49482f8 | 2018-11-19 17:10:36 +0000 | [diff] [blame] | 54 | ; SIMD128-NEXT: .functype trunc_sat_s_v4i32 (v128) -> (v128){{$}} |
Thomas Lively | 6f77811 | 2018-10-02 01:52:21 +0000 | [diff] [blame] | 55 | ; SIMD128-NEXT: i32x4.trunc_sat_s/f32x4 $push[[R:[0-9]+]]=, $0 |
Thomas Lively | c949857 | 2018-09-26 00:34:36 +0000 | [diff] [blame] | 56 | ; SIMD128-NEXT: return $pop[[R]] |
Thomas Lively | 6f77811 | 2018-10-02 01:52:21 +0000 | [diff] [blame] | 57 | define <4 x i32> @trunc_sat_s_v4i32(<4 x float> %x) { |
Thomas Lively | c949857 | 2018-09-26 00:34:36 +0000 | [diff] [blame] | 58 | %a = fptosi <4 x float> %x to <4 x i32> |
| 59 | ret <4 x i32> %a |
| 60 | } |
| 61 | |
Thomas Lively | 6f77811 | 2018-10-02 01:52:21 +0000 | [diff] [blame] | 62 | ; CHECK-LABEL: trunc_sat_u_v4i32: |
Thomas Lively | c949857 | 2018-09-26 00:34:36 +0000 | [diff] [blame] | 63 | ; NO-SIMD128-NOT: f32x4 |
Wouter van Oortmerssen | 49482f8 | 2018-11-19 17:10:36 +0000 | [diff] [blame] | 64 | ; SIMD128-NEXT: .functype trunc_sat_u_v4i32 (v128) -> (v128){{$}} |
Thomas Lively | 6f77811 | 2018-10-02 01:52:21 +0000 | [diff] [blame] | 65 | ; SIMD128-NEXT: i32x4.trunc_sat_u/f32x4 $push[[R:[0-9]+]]=, $0 |
Thomas Lively | c949857 | 2018-09-26 00:34:36 +0000 | [diff] [blame] | 66 | ; SIMD128-NEXT: return $pop[[R]] |
Thomas Lively | 6f77811 | 2018-10-02 01:52:21 +0000 | [diff] [blame] | 67 | define <4 x i32> @trunc_sat_u_v4i32(<4 x float> %x) { |
Thomas Lively | c949857 | 2018-09-26 00:34:36 +0000 | [diff] [blame] | 68 | %a = fptoui <4 x float> %x to <4 x i32> |
| 69 | ret <4 x i32> %a |
| 70 | } |
| 71 | |
Thomas Lively | 6f77811 | 2018-10-02 01:52:21 +0000 | [diff] [blame] | 72 | ; CHECK-LABEL: trunc_sat_s_v2i64: |
Thomas Lively | c949857 | 2018-09-26 00:34:36 +0000 | [diff] [blame] | 73 | ; NO-SIMD128-NOT: f64x2 |
Thomas Lively | 6f77811 | 2018-10-02 01:52:21 +0000 | [diff] [blame] | 74 | ; SIMD128-VM-NOT: i64x2.trunc_sat_s/f64x2 |
Wouter van Oortmerssen | 49482f8 | 2018-11-19 17:10:36 +0000 | [diff] [blame] | 75 | ; SIMD128-NEXT: .functype trunc_sat_s_v2i64 (v128) -> (v128){{$}} |
Thomas Lively | 6f77811 | 2018-10-02 01:52:21 +0000 | [diff] [blame] | 76 | ; SIMD128-NEXT: i64x2.trunc_sat_s/f64x2 $push[[R:[0-9]+]]=, $0 |
Thomas Lively | c949857 | 2018-09-26 00:34:36 +0000 | [diff] [blame] | 77 | ; SIMD128-NEXT: return $pop[[R]] |
Thomas Lively | 6f77811 | 2018-10-02 01:52:21 +0000 | [diff] [blame] | 78 | define <2 x i64> @trunc_sat_s_v2i64(<2 x double> %x) { |
Thomas Lively | c949857 | 2018-09-26 00:34:36 +0000 | [diff] [blame] | 79 | %a = fptosi <2 x double> %x to <2 x i64> |
| 80 | ret <2 x i64> %a |
| 81 | } |
| 82 | |
Thomas Lively | 6f77811 | 2018-10-02 01:52:21 +0000 | [diff] [blame] | 83 | ; CHECK-LABEL: trunc_sat_u_v2i64: |
Thomas Lively | c949857 | 2018-09-26 00:34:36 +0000 | [diff] [blame] | 84 | ; NO-SIMD128-NOT: f64x2 |
Thomas Lively | 6f77811 | 2018-10-02 01:52:21 +0000 | [diff] [blame] | 85 | ; SIMD128-VM-NOT: i64x2.trunc_sat_u/f64x2 |
Wouter van Oortmerssen | 49482f8 | 2018-11-19 17:10:36 +0000 | [diff] [blame] | 86 | ; SIMD128-NEXT: .functype trunc_sat_u_v2i64 (v128) -> (v128){{$}} |
Thomas Lively | 6f77811 | 2018-10-02 01:52:21 +0000 | [diff] [blame] | 87 | ; SIMD128-NEXT: i64x2.trunc_sat_u/f64x2 $push[[R:[0-9]+]]=, $0 |
Thomas Lively | c949857 | 2018-09-26 00:34:36 +0000 | [diff] [blame] | 88 | ; SIMD128-NEXT: return $pop[[R]] |
Thomas Lively | 6f77811 | 2018-10-02 01:52:21 +0000 | [diff] [blame] | 89 | define <2 x i64> @trunc_sat_u_v2i64(<2 x double> %x) { |
Thomas Lively | c949857 | 2018-09-26 00:34:36 +0000 | [diff] [blame] | 90 | %a = fptoui <2 x double> %x to <2 x i64> |
| 91 | ret <2 x i64> %a |
| 92 | } |