145 lines · plain
1; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py2; RUN: llc < %s -mattr=+simd128 | FileCheck %s3 4; TODO: These tests should check that floating point conversions select5; extending instructions where possible6 7target triple = "wasm32-unknown-unknown"8 9define <4 x float> @extend_to_float_low_i16x8_u(<8 x i16> %x) {10; CHECK-LABEL: extend_to_float_low_i16x8_u:11; CHECK: .functype extend_to_float_low_i16x8_u (v128) -> (v128)12; CHECK-NEXT: # %bb.0:13; CHECK-NEXT: local.get 014; CHECK-NEXT: i32x4.extend_low_i16x8_u15; CHECK-NEXT: f32x4.convert_i32x4_s16; CHECK-NEXT: # fallthrough-return17 %low = shufflevector <8 x i16> %x, <8 x i16> undef, <4 x i32> <i32 0, i32 1, i32 2, i32 3>18 %extended = uitofp <4 x i16> %low to <4 x float>19 ret <4 x float> %extended20}21 22define <4 x float> @extend_to_float_high_i16x8_u(<8 x i16> %x) {23; CHECK-LABEL: extend_to_float_high_i16x8_u:24; CHECK: .functype extend_to_float_high_i16x8_u (v128) -> (v128)25; CHECK-NEXT: # %bb.0:26; CHECK-NEXT: local.get 027; CHECK-NEXT: i32x4.extend_high_i16x8_u28; CHECK-NEXT: f32x4.convert_i32x4_s29; CHECK-NEXT: # fallthrough-return30 %high = shufflevector <8 x i16> %x, <8 x i16> undef, <4 x i32> <i32 4, i32 5, i32 6, i32 7>31 %extended = uitofp <4 x i16> %high to <4 x float>32 ret <4 x float> %extended33}34 35define <4 x float> @extend_to_float_low_i8x16_u(<8 x i8> %x) {36; CHECK-LABEL: extend_to_float_low_i8x16_u:37; CHECK: .functype extend_to_float_low_i8x16_u (v128) -> (v128)38; CHECK-NEXT: # %bb.0:39; CHECK-NEXT: local.get 040; CHECK-NEXT: i16x8.extend_low_i8x16_u41; CHECK-NEXT: i32x4.extend_low_i16x8_u42; CHECK-NEXT: f32x4.convert_i32x4_s43; CHECK-NEXT: # fallthrough-return44 %low = shufflevector <8 x i8> %x, <8 x i8> undef, <4 x i32> <i32 0, i32 1, i32 2, i32 3>45 %extended = uitofp <4 x i8> %low to <4 x float>46 ret <4 x float> %extended47}48 49define <4 x float> @extend_to_float_high_i8x16_u(<8 x i8> %x) {50; CHECK-LABEL: extend_to_float_high_i8x16_u:51; CHECK: .functype extend_to_float_high_i8x16_u (v128) -> (v128)52; CHECK-NEXT: # %bb.0:53; CHECK-NEXT: local.get 054; CHECK-NEXT: local.get 055; CHECK-NEXT: i8x16.shuffle 4, 5, 6, 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 056; CHECK-NEXT: i16x8.extend_low_i8x16_u57; CHECK-NEXT: i32x4.extend_low_i16x8_u58; CHECK-NEXT: f32x4.convert_i32x4_s59; CHECK-NEXT: # fallthrough-return60 %high = shufflevector <8 x i8> %x, <8 x i8> undef, <4 x i32> <i32 4, i32 5, i32 6, i32 7>61 %extended = uitofp <4 x i8> %high to <4 x float>62 ret <4 x float> %extended63}64 65define <4 x float> @extend_to_float_low_i16x8_s(<8 x i16> %x) {66; CHECK-LABEL: extend_to_float_low_i16x8_s:67; CHECK: .functype extend_to_float_low_i16x8_s (v128) -> (v128)68; CHECK-NEXT: # %bb.0:69; CHECK-NEXT: local.get 070; CHECK-NEXT: i32x4.extend_low_i16x8_s71; CHECK-NEXT: f32x4.convert_i32x4_s72; CHECK-NEXT: # fallthrough-return73 %low = shufflevector <8 x i16> %x, <8 x i16> undef, <4 x i32> <i32 0, i32 1, i32 2, i32 3>74 %extended = sitofp <4 x i16> %low to <4 x float>75 ret <4 x float> %extended76}77 78define <4 x float> @extend_to_float_high_i16x8_s(<8 x i16> %x) {79; CHECK-LABEL: extend_to_float_high_i16x8_s:80; CHECK: .functype extend_to_float_high_i16x8_s (v128) -> (v128)81; CHECK-NEXT: # %bb.0:82; CHECK-NEXT: local.get 083; CHECK-NEXT: i32x4.extend_high_i16x8_s84; CHECK-NEXT: f32x4.convert_i32x4_s85; CHECK-NEXT: # fallthrough-return86 %high = shufflevector <8 x i16> %x, <8 x i16> undef, <4 x i32> <i32 4, i32 5, i32 6, i32 7>87 %extended = sitofp <4 x i16> %high to <4 x float>88 ret <4 x float> %extended89}90 91define <4 x float> @extend_to_float_low_i8x16_s(<8 x i8> %x) {92; CHECK-LABEL: extend_to_float_low_i8x16_s:93; CHECK: .functype extend_to_float_low_i8x16_s (v128) -> (v128)94; CHECK-NEXT: # %bb.0:95; CHECK-NEXT: local.get 096; CHECK-NEXT: i16x8.extend_low_i8x16_s97; CHECK-NEXT: i32x4.extend_low_i16x8_s98; CHECK-NEXT: f32x4.convert_i32x4_s99; CHECK-NEXT: # fallthrough-return100 %low = shufflevector <8 x i8> %x, <8 x i8> undef, <4 x i32> <i32 0, i32 1, i32 2, i32 3>101 %extended = sitofp <4 x i8> %low to <4 x float>102 ret <4 x float> %extended103}104 105define <4 x float> @extend_to_float_high_i8x16_s(<8 x i8> %x) {106; CHECK-LABEL: extend_to_float_high_i8x16_s:107; CHECK: .functype extend_to_float_high_i8x16_s (v128) -> (v128)108; CHECK-NEXT: # %bb.0:109; CHECK-NEXT: local.get 0110; CHECK-NEXT: local.get 0111; CHECK-NEXT: i8x16.shuffle 4, 5, 6, 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0112; CHECK-NEXT: i16x8.extend_low_i8x16_s113; CHECK-NEXT: i32x4.extend_low_i16x8_s114; CHECK-NEXT: f32x4.convert_i32x4_s115; CHECK-NEXT: # fallthrough-return116 %high = shufflevector <8 x i8> %x, <8 x i8> undef, <4 x i32> <i32 4, i32 5, i32 6, i32 7>117 %extended = sitofp <4 x i8> %high to <4 x float>118 ret <4 x float> %extended119}120 121define <2 x double> @extend_to_double_low_i32x4_u(<4 x i32> %x) {122; CHECK-LABEL: extend_to_double_low_i32x4_u:123; CHECK: .functype extend_to_double_low_i32x4_u (v128) -> (v128)124; CHECK-NEXT: # %bb.0:125; CHECK-NEXT: local.get 0126; CHECK-NEXT: f64x2.convert_low_i32x4_u127; CHECK-NEXT: # fallthrough-return128 %low = shufflevector <4 x i32> %x, <4 x i32> undef, <2 x i32> <i32 0, i32 1>129 %extended = uitofp <2 x i32> %low to <2 x double>130 ret <2 x double> %extended131}132 133define <2 x double> @extend_to_double_low_i16x4_u(<4 x i16> %x) {134; CHECK-LABEL: extend_to_double_low_i16x4_u:135; CHECK: .functype extend_to_double_low_i16x4_u (v128) -> (v128)136; CHECK-NEXT: # %bb.0:137; CHECK-NEXT: local.get 0138; CHECK-NEXT: i32x4.extend_low_i16x8_u139; CHECK-NEXT: f64x2.convert_low_i32x4_s140; CHECK-NEXT: # fallthrough-return141 %low = shufflevector <4 x i16> %x, <4 x i16> undef, <2 x i32> <i32 0, i32 1>142 %extended = uitofp <2 x i16> %low to <2 x double>143 ret <2 x double> %extended144}145