xref: /llvm-project/llvm/test/CodeGen/X86/f16c-intrinsics-upgrade.ll (revision 2f448bf509432c1a19ec46ab8cbc7353c03c6280)
1; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
2; RUN: llc < %s -mtriple=i686-unknown-unknown   -mattr=+avx,+f16c -show-mc-encoding -disable-peephole | FileCheck %s --check-prefixes=AVX,X86
3; RUN: llc < %s -mtriple=x86_64-unknown-unknown -mattr=+avx,+f16c -show-mc-encoding -disable-peephole | FileCheck %s --check-prefixes=AVX,X64
4; RUN: llc < %s -mtriple=i686-unknown-unknown   -mattr=+avx512vl -show-mc-encoding -disable-peephole | FileCheck %s --check-prefixes=AVX512VL,X86-AVX512VL
5; RUN: llc < %s -mtriple=x86_64-unknown-unknown -mattr=+avx512vl -show-mc-encoding -disable-peephole | FileCheck %s --check-prefixes=AVX512VL,X64-AVX512VL
6
7define <4 x float> @test_x86_vcvtph2ps_128(<8 x i16> %a0) {
8; AVX-LABEL: test_x86_vcvtph2ps_128:
9; AVX:       # %bb.0:
10; AVX-NEXT:    vcvtph2ps %xmm0, %xmm0 # encoding: [0xc4,0xe2,0x79,0x13,0xc0]
11; AVX-NEXT:    ret{{[l|q]}} # encoding: [0xc3]
12;
13; AVX512VL-LABEL: test_x86_vcvtph2ps_128:
14; AVX512VL:       # %bb.0:
15; AVX512VL-NEXT:    vcvtph2ps %xmm0, %xmm0 # EVEX TO VEX Compression encoding: [0xc4,0xe2,0x79,0x13,0xc0]
16; AVX512VL-NEXT:    ret{{[l|q]}} # encoding: [0xc3]
17  %res = call <4 x float> @llvm.x86.vcvtph2ps.128(<8 x i16> %a0) ; <<4 x float>> [#uses=1]
18  ret <4 x float> %res
19}
20declare <4 x float> @llvm.x86.vcvtph2ps.128(<8 x i16>) nounwind readonly
21
22define <4 x float> @test_x86_vcvtph2ps_128_m(ptr nocapture %a) {
23; X86-LABEL: test_x86_vcvtph2ps_128_m:
24; X86:       # %bb.0:
25; X86-NEXT:    movl {{[0-9]+}}(%esp), %eax # encoding: [0x8b,0x44,0x24,0x04]
26; X86-NEXT:    vcvtph2ps (%eax), %xmm0 # encoding: [0xc4,0xe2,0x79,0x13,0x00]
27; X86-NEXT:    retl # encoding: [0xc3]
28;
29; X64-LABEL: test_x86_vcvtph2ps_128_m:
30; X64:       # %bb.0:
31; X64-NEXT:    vcvtph2ps (%rdi), %xmm0 # encoding: [0xc4,0xe2,0x79,0x13,0x07]
32; X64-NEXT:    retq # encoding: [0xc3]
33;
34; X86-AVX512VL-LABEL: test_x86_vcvtph2ps_128_m:
35; X86-AVX512VL:       # %bb.0:
36; X86-AVX512VL-NEXT:    movl {{[0-9]+}}(%esp), %eax # encoding: [0x8b,0x44,0x24,0x04]
37; X86-AVX512VL-NEXT:    vcvtph2ps (%eax), %xmm0 # EVEX TO VEX Compression encoding: [0xc4,0xe2,0x79,0x13,0x00]
38; X86-AVX512VL-NEXT:    retl # encoding: [0xc3]
39;
40; X64-AVX512VL-LABEL: test_x86_vcvtph2ps_128_m:
41; X64-AVX512VL:       # %bb.0:
42; X64-AVX512VL-NEXT:    vcvtph2ps (%rdi), %xmm0 # EVEX TO VEX Compression encoding: [0xc4,0xe2,0x79,0x13,0x07]
43; X64-AVX512VL-NEXT:    retq # encoding: [0xc3]
44  %load = load <8 x i16>, ptr %a
45  %res = call <4 x float> @llvm.x86.vcvtph2ps.128(<8 x i16> %load) ; <<4 x float>> [#uses=1]
46  ret <4 x float> %res
47}
48
49define <8 x float> @test_x86_vcvtph2ps_256(<8 x i16> %a0) {
50; AVX-LABEL: test_x86_vcvtph2ps_256:
51; AVX:       # %bb.0:
52; AVX-NEXT:    vcvtph2ps %xmm0, %ymm0 # encoding: [0xc4,0xe2,0x7d,0x13,0xc0]
53; AVX-NEXT:    ret{{[l|q]}} # encoding: [0xc3]
54;
55; AVX512VL-LABEL: test_x86_vcvtph2ps_256:
56; AVX512VL:       # %bb.0:
57; AVX512VL-NEXT:    vcvtph2ps %xmm0, %ymm0 # EVEX TO VEX Compression encoding: [0xc4,0xe2,0x7d,0x13,0xc0]
58; AVX512VL-NEXT:    ret{{[l|q]}} # encoding: [0xc3]
59  %res = call <8 x float> @llvm.x86.vcvtph2ps.256(<8 x i16> %a0) ; <<8 x float>> [#uses=1]
60  ret <8 x float> %res
61}
62declare <8 x float> @llvm.x86.vcvtph2ps.256(<8 x i16>) nounwind readonly
63
64define <8 x float> @test_x86_vcvtph2ps_256_m(ptr nocapture %a) nounwind {
65; X86-LABEL: test_x86_vcvtph2ps_256_m:
66; X86:       # %bb.0:
67; X86-NEXT:    movl {{[0-9]+}}(%esp), %eax # encoding: [0x8b,0x44,0x24,0x04]
68; X86-NEXT:    vcvtph2ps (%eax), %ymm0 # encoding: [0xc4,0xe2,0x7d,0x13,0x00]
69; X86-NEXT:    retl # encoding: [0xc3]
70;
71; X64-LABEL: test_x86_vcvtph2ps_256_m:
72; X64:       # %bb.0:
73; X64-NEXT:    vcvtph2ps (%rdi), %ymm0 # encoding: [0xc4,0xe2,0x7d,0x13,0x07]
74; X64-NEXT:    retq # encoding: [0xc3]
75;
76; X86-AVX512VL-LABEL: test_x86_vcvtph2ps_256_m:
77; X86-AVX512VL:       # %bb.0:
78; X86-AVX512VL-NEXT:    movl {{[0-9]+}}(%esp), %eax # encoding: [0x8b,0x44,0x24,0x04]
79; X86-AVX512VL-NEXT:    vcvtph2ps (%eax), %ymm0 # EVEX TO VEX Compression encoding: [0xc4,0xe2,0x7d,0x13,0x00]
80; X86-AVX512VL-NEXT:    retl # encoding: [0xc3]
81;
82; X64-AVX512VL-LABEL: test_x86_vcvtph2ps_256_m:
83; X64-AVX512VL:       # %bb.0:
84; X64-AVX512VL-NEXT:    vcvtph2ps (%rdi), %ymm0 # EVEX TO VEX Compression encoding: [0xc4,0xe2,0x7d,0x13,0x07]
85; X64-AVX512VL-NEXT:    retq # encoding: [0xc3]
86  %load = load <8 x i16>, ptr %a
87  %res = tail call <8 x float> @llvm.x86.vcvtph2ps.256(<8 x i16> %load)
88  ret <8 x float> %res
89}
90
91define <4 x float> @test_x86_vcvtph2ps_128_scalar(ptr %ptr) {
92; X86-LABEL: test_x86_vcvtph2ps_128_scalar:
93; X86:       # %bb.0:
94; X86-NEXT:    movl {{[0-9]+}}(%esp), %eax # encoding: [0x8b,0x44,0x24,0x04]
95; X86-NEXT:    vcvtph2ps (%eax), %xmm0 # encoding: [0xc4,0xe2,0x79,0x13,0x00]
96; X86-NEXT:    retl # encoding: [0xc3]
97;
98; X64-LABEL: test_x86_vcvtph2ps_128_scalar:
99; X64:       # %bb.0:
100; X64-NEXT:    vcvtph2ps (%rdi), %xmm0 # encoding: [0xc4,0xe2,0x79,0x13,0x07]
101; X64-NEXT:    retq # encoding: [0xc3]
102;
103; X86-AVX512VL-LABEL: test_x86_vcvtph2ps_128_scalar:
104; X86-AVX512VL:       # %bb.0:
105; X86-AVX512VL-NEXT:    movl {{[0-9]+}}(%esp), %eax # encoding: [0x8b,0x44,0x24,0x04]
106; X86-AVX512VL-NEXT:    vcvtph2ps (%eax), %xmm0 # EVEX TO VEX Compression encoding: [0xc4,0xe2,0x79,0x13,0x00]
107; X86-AVX512VL-NEXT:    retl # encoding: [0xc3]
108;
109; X64-AVX512VL-LABEL: test_x86_vcvtph2ps_128_scalar:
110; X64-AVX512VL:       # %bb.0:
111; X64-AVX512VL-NEXT:    vcvtph2ps (%rdi), %xmm0 # EVEX TO VEX Compression encoding: [0xc4,0xe2,0x79,0x13,0x07]
112; X64-AVX512VL-NEXT:    retq # encoding: [0xc3]
113  %load = load i64, ptr %ptr
114  %ins1 = insertelement <2 x i64> undef, i64 %load, i32 0
115  %ins2 = insertelement <2 x i64> %ins1, i64 0, i32 1
116  %bc = bitcast <2 x i64> %ins2 to <8 x i16>
117  %res = tail call <4 x float> @llvm.x86.vcvtph2ps.128(<8 x i16> %bc) #2
118  ret <4 x float> %res
119}
120
121define <4 x float> @test_x86_vcvtph2ps_128_scalar2(ptr %ptr) {
122; X86-LABEL: test_x86_vcvtph2ps_128_scalar2:
123; X86:       # %bb.0:
124; X86-NEXT:    movl {{[0-9]+}}(%esp), %eax # encoding: [0x8b,0x44,0x24,0x04]
125; X86-NEXT:    vcvtph2ps (%eax), %xmm0 # encoding: [0xc4,0xe2,0x79,0x13,0x00]
126; X86-NEXT:    retl # encoding: [0xc3]
127;
128; X64-LABEL: test_x86_vcvtph2ps_128_scalar2:
129; X64:       # %bb.0:
130; X64-NEXT:    vcvtph2ps (%rdi), %xmm0 # encoding: [0xc4,0xe2,0x79,0x13,0x07]
131; X64-NEXT:    retq # encoding: [0xc3]
132;
133; X86-AVX512VL-LABEL: test_x86_vcvtph2ps_128_scalar2:
134; X86-AVX512VL:       # %bb.0:
135; X86-AVX512VL-NEXT:    movl {{[0-9]+}}(%esp), %eax # encoding: [0x8b,0x44,0x24,0x04]
136; X86-AVX512VL-NEXT:    vcvtph2ps (%eax), %xmm0 # EVEX TO VEX Compression encoding: [0xc4,0xe2,0x79,0x13,0x00]
137; X86-AVX512VL-NEXT:    retl # encoding: [0xc3]
138;
139; X64-AVX512VL-LABEL: test_x86_vcvtph2ps_128_scalar2:
140; X64-AVX512VL:       # %bb.0:
141; X64-AVX512VL-NEXT:    vcvtph2ps (%rdi), %xmm0 # EVEX TO VEX Compression encoding: [0xc4,0xe2,0x79,0x13,0x07]
142; X64-AVX512VL-NEXT:    retq # encoding: [0xc3]
143  %load = load i64, ptr %ptr
144  %ins = insertelement <2 x i64> undef, i64 %load, i32 0
145  %bc = bitcast <2 x i64> %ins to <8 x i16>
146  %res = tail call <4 x float> @llvm.x86.vcvtph2ps.128(<8 x i16> %bc)
147  ret <4 x float> %res
148}
149