xref: /llvm-project/llvm/test/Analysis/CostModel/AArch64/sve-bitcast.ll (revision 75f1b328f8fb2468e8bef618b022ad8ce928097d)
1; RUN: opt -mtriple=aarch64-linux-gnu -mattr=+sve -passes="print<cost-model>" 2>&1 -disable-output < %s | FileCheck %s
2
3; Integer to float bitcasts
4
5target datalayout = "e-m:e-i8:8:32-i16:16:32-i64:64-i128:128-n32:64-S128"
6
7define <vscale x 2 x double> @test_nxv2f64(<vscale x 2 x i64> %a) {
8; CHECK-LABEL: test_nxv2f64
9; CHECK: Found an estimated cost of 0 for instruction:   %b = bitcast <vscale x 2 x i64> %a to <vscale x 2 x double>
10  %b = bitcast <vscale x 2 x i64> %a to <vscale x 2 x double>
11  ret <vscale x 2 x double> %b
12}
13
14define <vscale x 2 x half> @test_nxv2f16(<vscale x 2 x i16> %a) {
15; CHECK-LABEL: test_nxv2f16
16; CHECK: Found an estimated cost of 0 for instruction:   %b = bitcast <vscale x 2 x i16> %a to <vscale x 2 x half>
17  %b = bitcast <vscale x 2 x i16> %a to <vscale x 2 x half>
18  ret <vscale x 2 x half> %b
19}
20
21define <vscale x 4 x half> @test_nxv4f16(<vscale x 4 x i16> %a) {
22; CHECK-LABEL: test_nxv4f16
23; CHECK: Found an estimated cost of 0 for instruction:   %b = bitcast <vscale x 4 x i16> %a to <vscale x 4 x half>
24  %b = bitcast <vscale x 4 x i16> %a to <vscale x 4 x half>
25  ret <vscale x 4 x half> %b
26}
27
28define <vscale x 2 x float> @test_nxv2f32(<vscale x 2 x i32> %a) {
29; CHECK-LABEL: test_nxv2f32
30; CHECK: Found an estimated cost of 0 for instruction:   %b = bitcast <vscale x 2 x i32> %a to <vscale x 2 x float>
31  %b = bitcast <vscale x 2 x i32> %a to <vscale x 2 x float>
32  ret <vscale x 2 x float> %b
33}
34
35; Float to integer bitcasts
36
37define <vscale x 2 x i64> @test_nxv2i64(<vscale x 2 x double> %a) {
38; CHECK-LABEL: test_nxv2i64
39; CHECK: Found an estimated cost of 0 for instruction:   %b = bitcast <vscale x 2 x double> %a to <vscale x 2 x i64>
40  %b = bitcast <vscale x 2 x double> %a to <vscale x 2 x i64>
41  ret <vscale x 2 x i64> %b
42}
43
44define <vscale x 2 x i16> @test_nxv2i16(<vscale x 2 x half> %a) {
45; CHECK-LABEL: test_nxv2i16
46; CHECK: Found an estimated cost of 0 for instruction:   %b = bitcast <vscale x 2 x half> %a to <vscale x 2 x i16>
47  %b = bitcast <vscale x 2 x half> %a to <vscale x 2 x i16>
48  ret <vscale x 2 x i16> %b
49}
50
51define <vscale x 4 x i16> @test_nxv4i16(<vscale x 4 x half> %a) {
52; CHECK-LABEL: test_nxv4i16
53; CHECK: Found an estimated cost of 0 for instruction:   %b = bitcast <vscale x 4 x half> %a to <vscale x 4 x i16>
54  %b = bitcast <vscale x 4 x half> %a to <vscale x 4 x i16>
55  ret <vscale x 4 x i16> %b
56}
57
58define <vscale x 2 x i32> @test_nxv2i32(<vscale x 2 x float> %a) {
59; CHECK-LABEL: test_nxv2i32
60; CHECK: Found an estimated cost of 0 for instruction:   %b = bitcast <vscale x 2 x float> %a to <vscale x 2 x i32>
61  %b = bitcast <vscale x 2 x float> %a to <vscale x 2 x i32>
62  ret <vscale x 2 x i32> %b
63}
64