@@ -1903,3 +1903,290 @@ define <2 x float> @fneg_shuf_use3(<2 x float> %x, <2 x float> %y) {
1903
1903
%r = shufflevector <2 x float > %nx , <2 x float > %ny , <2 x i32 > <i32 1 , i32 2 >
1904
1904
ret <2 x float > %r
1905
1905
}
1906
+
1907
+ define <2 x i32 > @fptosi_unary_shuf (<2 x float > %x ) {
1908
+ ; CHECK-LABEL: @fptosi_unary_shuf(
1909
+ ; CHECK-NEXT: [[NX:%.*]] = fptosi <2 x float> [[X:%.*]] to <2 x i32>
1910
+ ; CHECK-NEXT: [[R:%.*]] = shufflevector <2 x i32> [[NX]], <2 x i32> poison, <2 x i32> <i32 1, i32 0>
1911
+ ; CHECK-NEXT: ret <2 x i32> [[R]]
1912
+ ;
1913
+ %nx = fptosi <2 x float > %x to <2 x i32 >
1914
+ %r = shufflevector <2 x i32 > %nx , <2 x i32 > poison, <2 x i32 > <i32 1 , i32 0 >
1915
+ ret <2 x i32 > %r
1916
+ }
1917
+
1918
+ define <2 x i64 > @fptoui_unary_shuf_widen_elts (<2 x float > %x ) {
1919
+ ; CHECK-LABEL: @fptoui_unary_shuf_widen_elts(
1920
+ ; CHECK-NEXT: [[NX:%.*]] = fptoui <2 x float> [[X:%.*]] to <2 x i64>
1921
+ ; CHECK-NEXT: [[R:%.*]] = shufflevector <2 x i64> [[NX]], <2 x i64> poison, <2 x i32> <i32 1, i32 0>
1922
+ ; CHECK-NEXT: ret <2 x i64> [[R]]
1923
+ ;
1924
+ %nx = fptoui <2 x float > %x to <2 x i64 >
1925
+ %r = shufflevector <2 x i64 > %nx , <2 x i64 > poison, <2 x i32 > <i32 1 , i32 0 >
1926
+ ret <2 x i64 > %r
1927
+ }
1928
+
1929
+ define <2 x half > @sitofp_unary_shuf_narrow_elts (<2 x i32 > %x ) {
1930
+ ; CHECK-LABEL: @sitofp_unary_shuf_narrow_elts(
1931
+ ; CHECK-NEXT: [[NX:%.*]] = sitofp <2 x i32> [[X:%.*]] to <2 x half>
1932
+ ; CHECK-NEXT: [[R:%.*]] = shufflevector <2 x half> [[NX]], <2 x half> poison, <2 x i32> <i32 1, i32 0>
1933
+ ; CHECK-NEXT: ret <2 x half> [[R]]
1934
+ ;
1935
+ %nx = sitofp <2 x i32 > %x to <2 x half >
1936
+ %r = shufflevector <2 x half > %nx , <2 x half > poison, <2 x i32 > <i32 1 , i32 0 >
1937
+ ret <2 x half > %r
1938
+ }
1939
+
1940
+ define <2 x float > @uitofp_unary_shuf (<2 x i32 > %x ) {
1941
+ ; CHECK-LABEL: @uitofp_unary_shuf(
1942
+ ; CHECK-NEXT: [[NX:%.*]] = uitofp <2 x i32> [[X:%.*]] to <2 x float>
1943
+ ; CHECK-NEXT: [[R:%.*]] = shufflevector <2 x float> [[NX]], <2 x float> poison, <2 x i32> <i32 1, i32 0>
1944
+ ; CHECK-NEXT: ret <2 x float> [[R]]
1945
+ ;
1946
+ %nx = uitofp <2 x i32 > %x to <2 x float >
1947
+ %r = shufflevector <2 x float > %nx , <2 x float > poison, <2 x i32 > <i32 1 , i32 0 >
1948
+ ret <2 x float > %r
1949
+ }
1950
+
1951
+ define <4 x i16 > @fptosi_unary_shuf_widen (<2 x half > %x ) {
1952
+ ; CHECK-LABEL: @fptosi_unary_shuf_widen(
1953
+ ; CHECK-NEXT: [[NX:%.*]] = fptosi <2 x half> [[X:%.*]] to <2 x i16>
1954
+ ; CHECK-NEXT: [[R:%.*]] = shufflevector <2 x i16> [[NX]], <2 x i16> poison, <4 x i32> <i32 1, i32 0, i32 0, i32 undef>
1955
+ ; CHECK-NEXT: ret <4 x i16> [[R]]
1956
+ ;
1957
+ %nx = fptosi <2 x half > %x to <2 x i16 >
1958
+ %r = shufflevector <2 x i16 > %nx , <2 x i16 > poison, <4 x i32 > <i32 1 , i32 0 , i32 0 , i32 poison>
1959
+ ret <4 x i16 > %r
1960
+ }
1961
+
1962
+ define <4 x i32 > @fptoui_unary_shuf_widen_widen_elts (<2 x half > %x ) {
1963
+ ; CHECK-LABEL: @fptoui_unary_shuf_widen_widen_elts(
1964
+ ; CHECK-NEXT: [[NX:%.*]] = fptoui <2 x half> [[X:%.*]] to <2 x i32>
1965
+ ; CHECK-NEXT: [[R:%.*]] = shufflevector <2 x i32> [[NX]], <2 x i32> poison, <4 x i32> <i32 1, i32 0, i32 0, i32 undef>
1966
+ ; CHECK-NEXT: ret <4 x i32> [[R]]
1967
+ ;
1968
+ %nx = fptoui <2 x half > %x to <2 x i32 >
1969
+ %r = shufflevector <2 x i32 > %nx , <2 x i32 > poison, <4 x i32 > <i32 1 , i32 0 , i32 0 , i32 poison>
1970
+ ret <4 x i32 > %r
1971
+ }
1972
+
1973
+ define <4 x half > @sitofp_unary_shuf_widen_narrow_elts (<2 x i32 > %x ) {
1974
+ ; CHECK-LABEL: @sitofp_unary_shuf_widen_narrow_elts(
1975
+ ; CHECK-NEXT: [[NX:%.*]] = sitofp <2 x i32> [[X:%.*]] to <2 x half>
1976
+ ; CHECK-NEXT: [[R:%.*]] = shufflevector <2 x half> [[NX]], <2 x half> poison, <4 x i32> <i32 1, i32 0, i32 0, i32 undef>
1977
+ ; CHECK-NEXT: ret <4 x half> [[R]]
1978
+ ;
1979
+ %nx = sitofp <2 x i32 > %x to <2 x half >
1980
+ %r = shufflevector <2 x half > %nx , <2 x half > poison, <4 x i32 > <i32 1 , i32 0 , i32 0 , i32 poison>
1981
+ ret <4 x half > %r
1982
+ }
1983
+
1984
+ define <4 x half > @uitofp_unary_shuf_widen (<2 x i16 > %x ) {
1985
+ ; CHECK-LABEL: @uitofp_unary_shuf_widen(
1986
+ ; CHECK-NEXT: [[NX:%.*]] = uitofp <2 x i16> [[X:%.*]] to <2 x half>
1987
+ ; CHECK-NEXT: [[R:%.*]] = shufflevector <2 x half> [[NX]], <2 x half> poison, <4 x i32> <i32 1, i32 0, i32 0, i32 undef>
1988
+ ; CHECK-NEXT: ret <4 x half> [[R]]
1989
+ ;
1990
+ %nx = uitofp <2 x i16 > %x to <2 x half >
1991
+ %r = shufflevector <2 x half > %nx , <2 x half > poison, <4 x i32 > <i32 1 , i32 0 , i32 0 , i32 poison>
1992
+ ret <4 x half > %r
1993
+ }
1994
+
1995
+ define <2 x i16 > @fptosi_unary_shuf_narrow (<4 x half > %x ) {
1996
+ ; CHECK-LABEL: @fptosi_unary_shuf_narrow(
1997
+ ; CHECK-NEXT: [[NX:%.*]] = fptosi <4 x half> [[X:%.*]] to <4 x i16>
1998
+ ; CHECK-NEXT: [[R:%.*]] = shufflevector <4 x i16> [[NX]], <4 x i16> poison, <2 x i32> <i32 1, i32 0>
1999
+ ; CHECK-NEXT: ret <2 x i16> [[R]]
2000
+ ;
2001
+ %nx = fptosi <4 x half > %x to <4 x i16 >
2002
+ %r = shufflevector <4 x i16 > %nx , <4 x i16 > poison, <2 x i32 > <i32 1 , i32 0 >
2003
+ ret <2 x i16 > %r
2004
+ }
2005
+
2006
+ define <2 x i32 > @fptoui_unary_shuf_narrow_widen_elts (<4 x half > %x ) {
2007
+ ; CHECK-LABEL: @fptoui_unary_shuf_narrow_widen_elts(
2008
+ ; CHECK-NEXT: [[NX:%.*]] = fptoui <4 x half> [[X:%.*]] to <4 x i32>
2009
+ ; CHECK-NEXT: [[R:%.*]] = shufflevector <4 x i32> [[NX]], <4 x i32> poison, <2 x i32> <i32 3, i32 0>
2010
+ ; CHECK-NEXT: ret <2 x i32> [[R]]
2011
+ ;
2012
+ %nx = fptoui <4 x half > %x to <4 x i32 >
2013
+ %r = shufflevector <4 x i32 > %nx , <4 x i32 > poison, <2 x i32 > <i32 3 , i32 0 >
2014
+ ret <2 x i32 > %r
2015
+ }
2016
+
2017
+ define <2 x double > @sitofp_unary_shuf_narrow (<4 x i64 > %x ) {
2018
+ ; CHECK-LABEL: @sitofp_unary_shuf_narrow(
2019
+ ; CHECK-NEXT: [[NX:%.*]] = sitofp <4 x i64> [[X:%.*]] to <4 x double>
2020
+ ; CHECK-NEXT: [[R:%.*]] = shufflevector <4 x double> [[NX]], <4 x double> poison, <2 x i32> <i32 2, i32 1>
2021
+ ; CHECK-NEXT: ret <2 x double> [[R]]
2022
+ ;
2023
+ %nx = sitofp <4 x i64 > %x to <4 x double >
2024
+ %r = shufflevector <4 x double > %nx , <4 x double > poison, <2 x i32 > <i32 2 , i32 1 >
2025
+ ret <2 x double > %r
2026
+ }
2027
+
2028
+ define <2 x half > @uitofp_unary_shuf_narrow_narrow_elts (<4 x i32 > %x ) {
2029
+ ; CHECK-LABEL: @uitofp_unary_shuf_narrow_narrow_elts(
2030
+ ; CHECK-NEXT: [[NX:%.*]] = uitofp <4 x i32> [[X:%.*]] to <4 x half>
2031
+ ; CHECK-NEXT: [[R:%.*]] = shufflevector <4 x half> [[NX]], <4 x half> poison, <2 x i32> <i32 3, i32 1>
2032
+ ; CHECK-NEXT: ret <2 x half> [[R]]
2033
+ ;
2034
+ %nx = uitofp <4 x i32 > %x to <4 x half >
2035
+ %r = shufflevector <4 x half > %nx , <4 x half > poison, <2 x i32 > <i32 3 , i32 1 >
2036
+ ret <2 x half > %r
2037
+ }
2038
+
2039
+ define <4 x i32 > @fptosi_shuf (<4 x float > %x , <4 x float > %y ) {
2040
+ ; CHECK-LABEL: @fptosi_shuf(
2041
+ ; CHECK-NEXT: [[NX:%.*]] = fptosi <4 x float> [[X:%.*]] to <4 x i32>
2042
+ ; CHECK-NEXT: [[NY:%.*]] = fptosi <4 x float> [[Y:%.*]] to <4 x i32>
2043
+ ; CHECK-NEXT: [[R:%.*]] = shufflevector <4 x i32> [[NX]], <4 x i32> [[NY]], <4 x i32> <i32 0, i32 1, i32 4, i32 5>
2044
+ ; CHECK-NEXT: ret <4 x i32> [[R]]
2045
+ ;
2046
+ %nx = fptosi <4 x float > %x to <4 x i32 >
2047
+ %ny = fptosi <4 x float > %y to <4 x i32 >
2048
+ %r = shufflevector <4 x i32 > %nx , <4 x i32 > %ny , <4 x i32 > <i32 0 , i32 1 , i32 4 , i32 5 >
2049
+ ret <4 x i32 > %r
2050
+ }
2051
+
2052
+ define <3 x i16 > @fptoui_shuf (<3 x half > %x , <3 x half > %y ) {
2053
+ ; CHECK-LABEL: @fptoui_shuf(
2054
+ ; CHECK-NEXT: [[NX:%.*]] = fptoui <3 x half> [[X:%.*]] to <3 x i16>
2055
+ ; CHECK-NEXT: [[NY:%.*]] = fptoui <3 x half> [[Y:%.*]] to <3 x i16>
2056
+ ; CHECK-NEXT: [[R:%.*]] = shufflevector <3 x i16> [[NX]], <3 x i16> [[NY]], <3 x i32> <i32 0, i32 undef, i32 4>
2057
+ ; CHECK-NEXT: ret <3 x i16> [[R]]
2058
+ ;
2059
+ %nx = fptoui <3 x half > %x to <3 x i16 >
2060
+ %ny = fptoui <3 x half > %y to <3 x i16 >
2061
+ %r = shufflevector <3 x i16 > %nx , <3 x i16 > %ny , <3 x i32 > <i32 0 , i32 poison, i32 4 >
2062
+ ret <3 x i16 > %r
2063
+ }
2064
+
2065
+ define <3 x i16 > @fptoui_shuf_different_source_types (<3 x float > %x , <3 x half > %y ) {
2066
+ ; CHECK-LABEL: @fptoui_shuf_different_source_types(
2067
+ ; CHECK-NEXT: [[NX:%.*]] = fptoui <3 x float> [[X:%.*]] to <3 x i16>
2068
+ ; CHECK-NEXT: [[NY:%.*]] = fptoui <3 x half> [[Y:%.*]] to <3 x i16>
2069
+ ; CHECK-NEXT: [[R:%.*]] = shufflevector <3 x i16> [[NX]], <3 x i16> [[NY]], <3 x i32> <i32 0, i32 2, i32 4>
2070
+ ; CHECK-NEXT: ret <3 x i16> [[R]]
2071
+ ;
2072
+ %nx = fptoui <3 x float > %x to <3 x i16 >
2073
+ %ny = fptoui <3 x half > %y to <3 x i16 >
2074
+ %r = shufflevector <3 x i16 > %nx , <3 x i16 > %ny , <3 x i32 > <i32 0 , i32 2 , i32 4 >
2075
+ ret <3 x i16 > %r
2076
+ }
2077
+
2078
+ define <4 x i32 > @fptoui_shuf_widen_elts (<4 x half > %x , <4 x half > %y ) {
2079
+ ; CHECK-LABEL: @fptoui_shuf_widen_elts(
2080
+ ; CHECK-NEXT: [[NX:%.*]] = fptosi <4 x half> [[X:%.*]] to <4 x i32>
2081
+ ; CHECK-NEXT: [[NY:%.*]] = fptosi <4 x half> [[Y:%.*]] to <4 x i32>
2082
+ ; CHECK-NEXT: [[R:%.*]] = shufflevector <4 x i32> [[NX]], <4 x i32> [[NY]], <4 x i32> <i32 0, i32 1, i32 4, i32 5>
2083
+ ; CHECK-NEXT: ret <4 x i32> [[R]]
2084
+ ;
2085
+ %nx = fptosi <4 x half > %x to <4 x i32 >
2086
+ %ny = fptosi <4 x half > %y to <4 x i32 >
2087
+ %r = shufflevector <4 x i32 > %nx , <4 x i32 > %ny , <4 x i32 > <i32 0 , i32 1 , i32 4 , i32 5 >
2088
+ ret <4 x i32 > %r
2089
+ }
2090
+
2091
+ define <4 x float > @sitofp_shuf_narrow_elts (<4 x i64 > %x , <4 x i64 > %y ) {
2092
+ ; CHECK-LABEL: @sitofp_shuf_narrow_elts(
2093
+ ; CHECK-NEXT: [[NX:%.*]] = sitofp <4 x i64> [[X:%.*]] to <4 x float>
2094
+ ; CHECK-NEXT: [[NY:%.*]] = sitofp <4 x i64> [[Y:%.*]] to <4 x float>
2095
+ ; CHECK-NEXT: [[R:%.*]] = shufflevector <4 x float> [[NX]], <4 x float> [[NY]], <4 x i32> <i32 0, i32 1, i32 4, i32 5>
2096
+ ; CHECK-NEXT: ret <4 x float> [[R]]
2097
+ ;
2098
+ %nx = sitofp <4 x i64 > %x to <4 x float >
2099
+ %ny = sitofp <4 x i64 > %y to <4 x float >
2100
+ %r = shufflevector <4 x float > %nx , <4 x float > %ny , <4 x i32 > <i32 0 , i32 1 , i32 4 , i32 5 >
2101
+ ret <4 x float > %r
2102
+ }
2103
+
2104
+ define <4 x float > @uitofp_shuf_extra_use1 (<4 x i32 > %x , <4 x i32 > %y ) {
2105
+ ; CHECK-LABEL: @uitofp_shuf_extra_use1(
2106
+ ; CHECK-NEXT: [[NX:%.*]] = uitofp <4 x i32> [[X:%.*]] to <4 x float>
2107
+ ; CHECK-NEXT: call void @use4(<4 x float> [[NX]])
2108
+ ; CHECK-NEXT: [[NY:%.*]] = uitofp <4 x i32> [[Y:%.*]] to <4 x float>
2109
+ ; CHECK-NEXT: [[R:%.*]] = shufflevector <4 x float> [[NX]], <4 x float> [[NY]], <4 x i32> <i32 0, i32 0, i32 4, i32 5>
2110
+ ; CHECK-NEXT: ret <4 x float> [[R]]
2111
+ ;
2112
+ %nx = uitofp <4 x i32 > %x to <4 x float >
2113
+ call void @use4 (<4 x float > %nx )
2114
+ %ny = uitofp <4 x i32 > %y to <4 x float >
2115
+ %r = shufflevector <4 x float > %nx , <4 x float > %ny , <4 x i32 > <i32 0 , i32 0 , i32 4 , i32 5 >
2116
+ ret <4 x float > %r
2117
+ }
2118
+
2119
+ define <4 x float > @sitofp_shuf_extra_use2 (<4 x i32 > %x , <4 x i32 > %y ) {
2120
+ ; CHECK-LABEL: @sitofp_shuf_extra_use2(
2121
+ ; CHECK-NEXT: [[NX:%.*]] = sitofp <4 x i32> [[X:%.*]] to <4 x float>
2122
+ ; CHECK-NEXT: [[NY:%.*]] = sitofp <4 x i32> [[Y:%.*]] to <4 x float>
2123
+ ; CHECK-NEXT: call void @use4(<4 x float> [[NY]])
2124
+ ; CHECK-NEXT: [[R:%.*]] = shufflevector <4 x float> [[NX]], <4 x float> [[NY]], <4 x i32> <i32 7, i32 1, i32 4, i32 0>
2125
+ ; CHECK-NEXT: ret <4 x float> [[R]]
2126
+ ;
2127
+ %nx = sitofp <4 x i32 > %x to <4 x float >
2128
+ %ny = sitofp <4 x i32 > %y to <4 x float >
2129
+ call void @use4 (<4 x float > %ny )
2130
+ %r = shufflevector <4 x float > %nx , <4 x float > %ny , <4 x i32 > <i32 7 , i32 1 , i32 4 , i32 0 >
2131
+ ret <4 x float > %r
2132
+ }
2133
+
2134
+ define <2 x float > @sitofp_shuf_extra_use3 (<2 x i32 > %x , <2 x i32 > %y ) {
2135
+ ; CHECK-LABEL: @sitofp_shuf_extra_use3(
2136
+ ; CHECK-NEXT: [[NX:%.*]] = sitofp <2 x i32> [[X:%.*]] to <2 x float>
2137
+ ; CHECK-NEXT: call void @use(<2 x float> [[NX]])
2138
+ ; CHECK-NEXT: [[NY:%.*]] = sitofp <2 x i32> [[Y:%.*]] to <2 x float>
2139
+ ; CHECK-NEXT: call void @use(<2 x float> [[NY]])
2140
+ ; CHECK-NEXT: [[R:%.*]] = shufflevector <2 x float> [[NX]], <2 x float> [[NY]], <2 x i32> <i32 3, i32 1>
2141
+ ; CHECK-NEXT: ret <2 x float> [[R]]
2142
+ ;
2143
+ %nx = sitofp <2 x i32 > %x to <2 x float >
2144
+ call void @use (<2 x float > %nx )
2145
+ %ny = sitofp <2 x i32 > %y to <2 x float >
2146
+ call void @use (<2 x float > %ny )
2147
+ %r = shufflevector <2 x float > %nx , <2 x float > %ny , <2 x i32 > <i32 3 , i32 1 >
2148
+ ret <2 x float > %r
2149
+ }
2150
+
2151
+ define <4 x i32 > @fptoi_shuf (<4 x float > %x , <4 x float > %y ) {
2152
+ ; CHECK-LABEL: @fptoi_shuf(
2153
+ ; CHECK-NEXT: [[NX:%.*]] = fptoui <4 x float> [[X:%.*]] to <4 x i32>
2154
+ ; CHECK-NEXT: [[NY:%.*]] = fptosi <4 x float> [[Y:%.*]] to <4 x i32>
2155
+ ; CHECK-NEXT: [[R:%.*]] = shufflevector <4 x i32> [[NX]], <4 x i32> [[NY]], <4 x i32> <i32 0, i32 1, i32 4, i32 5>
2156
+ ; CHECK-NEXT: ret <4 x i32> [[R]]
2157
+ ;
2158
+ %nx = fptoui <4 x float > %x to <4 x i32 >
2159
+ %ny = fptosi <4 x float > %y to <4 x i32 >
2160
+ %r = shufflevector <4 x i32 > %nx , <4 x i32 > %ny , <4 x i32 > <i32 0 , i32 1 , i32 4 , i32 5 >
2161
+ ret <4 x i32 > %r
2162
+ }
2163
+
2164
+ ; length-changing shuffle
2165
+
2166
+ define <4 x float > @sitofp_shuf_widen (<2 x i32 > %x , <2 x i32 > %y ) {
2167
+ ; CHECK-LABEL: @sitofp_shuf_widen(
2168
+ ; CHECK-NEXT: [[NX:%.*]] = sitofp <2 x i32> [[X:%.*]] to <2 x float>
2169
+ ; CHECK-NEXT: [[NY:%.*]] = sitofp <2 x i32> [[Y:%.*]] to <2 x float>
2170
+ ; CHECK-NEXT: [[R:%.*]] = shufflevector <2 x float> [[NX]], <2 x float> [[NY]], <4 x i32> <i32 undef, i32 1, i32 2, i32 3>
2171
+ ; CHECK-NEXT: ret <4 x float> [[R]]
2172
+ ;
2173
+ %nx = sitofp <2 x i32 > %x to <2 x float >
2174
+ %ny = sitofp <2 x i32 > %y to <2 x float >
2175
+ %r = shufflevector <2 x float > %nx , <2 x float > %ny , <4 x i32 > <i32 poison, i32 1 , i32 2 , i32 3 >
2176
+ ret <4 x float > %r
2177
+ }
2178
+
2179
+ ; length-changing shuffle
2180
+
2181
+ define <2 x float > @uitofp_shuf_narrow (<4 x i32 > %x , <4 x i32 > %y ) {
2182
+ ; CHECK-LABEL: @uitofp_shuf_narrow(
2183
+ ; CHECK-NEXT: [[NX:%.*]] = uitofp <4 x i32> [[X:%.*]] to <4 x float>
2184
+ ; CHECK-NEXT: [[NY:%.*]] = uitofp <4 x i32> [[Y:%.*]] to <4 x float>
2185
+ ; CHECK-NEXT: [[R:%.*]] = shufflevector <4 x float> [[NX]], <4 x float> [[NY]], <2 x i32> <i32 3, i32 5>
2186
+ ; CHECK-NEXT: ret <2 x float> [[R]]
2187
+ ;
2188
+ %nx = uitofp <4 x i32 > %x to <4 x float >
2189
+ %ny = uitofp <4 x i32 > %y to <4 x float >
2190
+ %r = shufflevector <4 x float > %nx , <4 x float > %ny , <2 x i32 > <i32 3 , i32 5 >
2191
+ ret <2 x float > %r
2192
+ }
0 commit comments