aboutsummaryrefslogtreecommitdiff
path: root/llvm/test/Analysis/CostModel/RISCV/insertelement.ll
blob: 6a57d1586773362302dc218818ac9d2dadafbca7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
; NOTE: Assertions have been autogenerated by utils/update_analyze_test_checks.py UTC_ARGS: --version 3
; RUN: opt -passes="print<cost-model>" 2>&1 -disable-output -mtriple=riscv32 -mattr=+f,+d,+zfh < %s | FileCheck %s --check-prefixes=RV32
; RUN: opt -passes="print<cost-model>" 2>&1 -disable-output -mtriple=riscv64 -mattr=+f,+d,+zfh < %s | FileCheck %s --check-prefixes=RV64

define void @insertelement_int(i32 %x) {
; RV32-LABEL: 'insertelement_int'
; RV32-NEXT:  Cost Model: Found an estimated cost of 5 for instruction: %v2i8 = insertelement <2 x i8> undef, i8 undef, i32 %x
; RV32-NEXT:  Cost Model: Found an estimated cost of 9 for instruction: %v4i8 = insertelement <4 x i8> undef, i8 undef, i32 %x
; RV32-NEXT:  Cost Model: Found an estimated cost of 17 for instruction: %v8i8 = insertelement <8 x i8> undef, i8 undef, i32 %x
; RV32-NEXT:  Cost Model: Found an estimated cost of 33 for instruction: %v16i8 = insertelement <16 x i8> undef, i8 undef, i32 %x
; RV32-NEXT:  Cost Model: Invalid cost for instruction: %nxv16i8 = insertelement <vscale x 16 x i8> undef, i8 undef, i32 %x
; RV32-NEXT:  Cost Model: Found an estimated cost of 5 for instruction: %v2i16 = insertelement <2 x i16> undef, i16 undef, i32 %x
; RV32-NEXT:  Cost Model: Found an estimated cost of 9 for instruction: %v4i16 = insertelement <4 x i16> undef, i16 undef, i32 %x
; RV32-NEXT:  Cost Model: Found an estimated cost of 17 for instruction: %v8i16 = insertelement <8 x i16> undef, i16 undef, i32 %x
; RV32-NEXT:  Cost Model: Found an estimated cost of 33 for instruction: %v16i16 = insertelement <16 x i16> undef, i16 undef, i32 %x
; RV32-NEXT:  Cost Model: Invalid cost for instruction: %nxv16i16 = insertelement <vscale x 16 x i16> undef, i16 undef, i32 %x
; RV32-NEXT:  Cost Model: Found an estimated cost of 5 for instruction: %v2i32 = insertelement <2 x i32> undef, i32 undef, i32 %x
; RV32-NEXT:  Cost Model: Found an estimated cost of 9 for instruction: %v4i32 = insertelement <4 x i32> undef, i32 undef, i32 %x
; RV32-NEXT:  Cost Model: Found an estimated cost of 17 for instruction: %v8i32 = insertelement <8 x i32> undef, i32 undef, i32 %x
; RV32-NEXT:  Cost Model: Found an estimated cost of 33 for instruction: %v16i32 = insertelement <16 x i32> undef, i32 undef, i32 %x
; RV32-NEXT:  Cost Model: Invalid cost for instruction: %nxv16i32 = insertelement <vscale x 16 x i32> undef, i32 undef, i32 %x
; RV32-NEXT:  Cost Model: Found an estimated cost of 10 for instruction: %v2i64 = insertelement <2 x i64> undef, i64 undef, i32 %x
; RV32-NEXT:  Cost Model: Found an estimated cost of 18 for instruction: %v4i64 = insertelement <4 x i64> undef, i64 undef, i32 %x
; RV32-NEXT:  Cost Model: Found an estimated cost of 34 for instruction: %v8i64 = insertelement <8 x i64> undef, i64 undef, i32 %x
; RV32-NEXT:  Cost Model: Found an estimated cost of 66 for instruction: %v16i64 = insertelement <16 x i64> undef, i64 undef, i32 %x
; RV32-NEXT:  Cost Model: Invalid cost for instruction: %nxv16i64 = insertelement <vscale x 16 x i64> undef, i64 undef, i32 %x
; RV32-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: ret void
;
; RV64-LABEL: 'insertelement_int'
; RV64-NEXT:  Cost Model: Found an estimated cost of 5 for instruction: %v2i8 = insertelement <2 x i8> undef, i8 undef, i32 %x
; RV64-NEXT:  Cost Model: Found an estimated cost of 9 for instruction: %v4i8 = insertelement <4 x i8> undef, i8 undef, i32 %x
; RV64-NEXT:  Cost Model: Found an estimated cost of 17 for instruction: %v8i8 = insertelement <8 x i8> undef, i8 undef, i32 %x
; RV64-NEXT:  Cost Model: Found an estimated cost of 33 for instruction: %v16i8 = insertelement <16 x i8> undef, i8 undef, i32 %x
; RV64-NEXT:  Cost Model: Invalid cost for instruction: %nxv16i8 = insertelement <vscale x 16 x i8> undef, i8 undef, i32 %x
; RV64-NEXT:  Cost Model: Found an estimated cost of 5 for instruction: %v2i16 = insertelement <2 x i16> undef, i16 undef, i32 %x
; RV64-NEXT:  Cost Model: Found an estimated cost of 9 for instruction: %v4i16 = insertelement <4 x i16> undef, i16 undef, i32 %x
; RV64-NEXT:  Cost Model: Found an estimated cost of 17 for instruction: %v8i16 = insertelement <8 x i16> undef, i16 undef, i32 %x
; RV64-NEXT:  Cost Model: Found an estimated cost of 33 for instruction: %v16i16 = insertelement <16 x i16> undef, i16 undef, i32 %x
; RV64-NEXT:  Cost Model: Invalid cost for instruction: %nxv16i16 = insertelement <vscale x 16 x i16> undef, i16 undef, i32 %x
; RV64-NEXT:  Cost Model: Found an estimated cost of 5 for instruction: %v2i32 = insertelement <2 x i32> undef, i32 undef, i32 %x
; RV64-NEXT:  Cost Model: Found an estimated cost of 9 for instruction: %v4i32 = insertelement <4 x i32> undef, i32 undef, i32 %x
; RV64-NEXT:  Cost Model: Found an estimated cost of 17 for instruction: %v8i32 = insertelement <8 x i32> undef, i32 undef, i32 %x
; RV64-NEXT:  Cost Model: Found an estimated cost of 33 for instruction: %v16i32 = insertelement <16 x i32> undef, i32 undef, i32 %x
; RV64-NEXT:  Cost Model: Invalid cost for instruction: %nxv16i32 = insertelement <vscale x 16 x i32> undef, i32 undef, i32 %x
; RV64-NEXT:  Cost Model: Found an estimated cost of 5 for instruction: %v2i64 = insertelement <2 x i64> undef, i64 undef, i32 %x
; RV64-NEXT:  Cost Model: Found an estimated cost of 9 for instruction: %v4i64 = insertelement <4 x i64> undef, i64 undef, i32 %x
; RV64-NEXT:  Cost Model: Found an estimated cost of 17 for instruction: %v8i64 = insertelement <8 x i64> undef, i64 undef, i32 %x
; RV64-NEXT:  Cost Model: Found an estimated cost of 33 for instruction: %v16i64 = insertelement <16 x i64> undef, i64 undef, i32 %x
; RV64-NEXT:  Cost Model: Invalid cost for instruction: %nxv16i64 = insertelement <vscale x 16 x i64> undef, i64 undef, i32 %x
; RV64-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: ret void
;
  %v2i8 = insertelement <2 x i8> undef, i8 undef, i32 %x
  %v4i8 = insertelement <4 x i8> undef, i8 undef, i32 %x
  %v8i8 = insertelement <8 x i8> undef, i8 undef, i32 %x
  %v16i8 = insertelement <16 x i8> undef, i8 undef, i32 %x
  %nxv16i8 = insertelement <vscale x 16 x i8> undef, i8 undef, i32 %x

  %v2i16 = insertelement <2 x i16> undef, i16 undef, i32 %x
  %v4i16 = insertelement <4 x i16> undef, i16 undef, i32 %x
  %v8i16 = insertelement <8 x i16> undef, i16 undef, i32 %x
  %v16i16 = insertelement <16 x i16> undef, i16 undef, i32 %x
  %nxv16i16 = insertelement <vscale x 16 x i16> undef, i16 undef, i32 %x

  %v2i32 = insertelement <2 x i32> undef, i32 undef, i32 %x
  %v4i32 = insertelement <4 x i32> undef, i32 undef, i32 %x
  %v8i32 = insertelement <8 x i32> undef, i32 undef, i32 %x
  %v16i32 = insertelement <16 x i32> undef, i32 undef, i32 %x
  %nxv16i32 = insertelement <vscale x 16 x i32> undef, i32 undef, i32 %x

  %v2i64 = insertelement <2 x i64> undef, i64 undef, i32 %x
  %v4i64 = insertelement <4 x i64> undef, i64 undef, i32 %x
  %v8i64 = insertelement <8 x i64> undef, i64 undef, i32 %x
  %v16i64 = insertelement <16 x i64> undef, i64 undef, i32 %x
  %nxv16i64 = insertelement <vscale x 16 x i64> undef, i64 undef, i32 %x

  ret void
}

define void @insertelement_fp(i32 %x) {
; RV32-LABEL: 'insertelement_fp'
; RV32-NEXT:  Cost Model: Found an estimated cost of 5 for instruction: %v2f16 = insertelement <2 x half> undef, half undef, i32 %x
; RV32-NEXT:  Cost Model: Found an estimated cost of 9 for instruction: %v4f16 = insertelement <4 x half> undef, half undef, i32 %x
; RV32-NEXT:  Cost Model: Found an estimated cost of 17 for instruction: %v8f16 = insertelement <8 x half> undef, half undef, i32 %x
; RV32-NEXT:  Cost Model: Found an estimated cost of 33 for instruction: %v16f16 = insertelement <16 x half> undef, half undef, i32 %x
; RV32-NEXT:  Cost Model: Invalid cost for instruction: %nxv16f16 = insertelement <vscale x 16 x half> undef, half undef, i32 %x
; RV32-NEXT:  Cost Model: Found an estimated cost of 5 for instruction: %v2f32 = insertelement <2 x float> undef, float undef, i32 %x
; RV32-NEXT:  Cost Model: Found an estimated cost of 9 for instruction: %v4f32 = insertelement <4 x float> undef, float undef, i32 %x
; RV32-NEXT:  Cost Model: Found an estimated cost of 17 for instruction: %v8f32 = insertelement <8 x float> undef, float undef, i32 %x
; RV32-NEXT:  Cost Model: Found an estimated cost of 33 for instruction: %v16f32 = insertelement <16 x float> undef, float undef, i32 %x
; RV32-NEXT:  Cost Model: Invalid cost for instruction: %nxv16f32 = insertelement <vscale x 16 x float> undef, float undef, i32 %x
; RV32-NEXT:  Cost Model: Found an estimated cost of 5 for instruction: %v2f64 = insertelement <2 x double> undef, double undef, i32 %x
; RV32-NEXT:  Cost Model: Found an estimated cost of 9 for instruction: %v4f64 = insertelement <4 x double> undef, double undef, i32 %x
; RV32-NEXT:  Cost Model: Found an estimated cost of 17 for instruction: %v8f64 = insertelement <8 x double> undef, double undef, i32 %x
; RV32-NEXT:  Cost Model: Found an estimated cost of 33 for instruction: %v16f64 = insertelement <16 x double> undef, double undef, i32 %x
; RV32-NEXT:  Cost Model: Invalid cost for instruction: %nxv16f64 = insertelement <vscale x 16 x double> undef, double undef, i32 %x
; RV32-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: ret void
;
; RV64-LABEL: 'insertelement_fp'
; RV64-NEXT:  Cost Model: Found an estimated cost of 5 for instruction: %v2f16 = insertelement <2 x half> undef, half undef, i32 %x
; RV64-NEXT:  Cost Model: Found an estimated cost of 9 for instruction: %v4f16 = insertelement <4 x half> undef, half undef, i32 %x
; RV64-NEXT:  Cost Model: Found an estimated cost of 17 for instruction: %v8f16 = insertelement <8 x half> undef, half undef, i32 %x
; RV64-NEXT:  Cost Model: Found an estimated cost of 33 for instruction: %v16f16 = insertelement <16 x half> undef, half undef, i32 %x
; RV64-NEXT:  Cost Model: Invalid cost for instruction: %nxv16f16 = insertelement <vscale x 16 x half> undef, half undef, i32 %x
; RV64-NEXT:  Cost Model: Found an estimated cost of 5 for instruction: %v2f32 = insertelement <2 x float> undef, float undef, i32 %x
; RV64-NEXT:  Cost Model: Found an estimated cost of 9 for instruction: %v4f32 = insertelement <4 x float> undef, float undef, i32 %x
; RV64-NEXT:  Cost Model: Found an estimated cost of 17 for instruction: %v8f32 = insertelement <8 x float> undef, float undef, i32 %x
; RV64-NEXT:  Cost Model: Found an estimated cost of 33 for instruction: %v16f32 = insertelement <16 x float> undef, float undef, i32 %x
; RV64-NEXT:  Cost Model: Invalid cost for instruction: %nxv16f32 = insertelement <vscale x 16 x float> undef, float undef, i32 %x
; RV64-NEXT:  Cost Model: Found an estimated cost of 5 for instruction: %v2f64 = insertelement <2 x double> undef, double undef, i32 %x
; RV64-NEXT:  Cost Model: Found an estimated cost of 9 for instruction: %v4f64 = insertelement <4 x double> undef, double undef, i32 %x
; RV64-NEXT:  Cost Model: Found an estimated cost of 17 for instruction: %v8f64 = insertelement <8 x double> undef, double undef, i32 %x
; RV64-NEXT:  Cost Model: Found an estimated cost of 33 for instruction: %v16f64 = insertelement <16 x double> undef, double undef, i32 %x
; RV64-NEXT:  Cost Model: Invalid cost for instruction: %nxv16f64 = insertelement <vscale x 16 x double> undef, double undef, i32 %x
; RV64-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: ret void
;
  %v2f16 = insertelement <2 x half> undef, half undef, i32 %x
  %v4f16 = insertelement <4 x half> undef, half undef, i32 %x
  %v8f16 = insertelement <8 x half> undef, half undef, i32 %x
  %v16f16 = insertelement <16 x half> undef, half undef, i32 %x
  %nxv16f16 = insertelement <vscale x 16 x half> undef, half undef, i32 %x

  %v2f32 = insertelement <2 x float> undef, float undef, i32 %x
  %v4f32 = insertelement <4 x float> undef, float undef, i32 %x
  %v8f32 = insertelement <8 x float> undef, float undef, i32 %x
  %v16f32 = insertelement <16 x float> undef, float undef, i32 %x
  %nxv16f32 = insertelement <vscale x 16 x float> undef, float undef, i32 %x

  %v2f64 = insertelement <2 x double> undef, double undef, i32 %x
  %v4f64 = insertelement <4 x double> undef, double undef, i32 %x
  %v8f64 = insertelement <8 x double> undef, double undef, i32 %x
  %v16f64 = insertelement <16 x double> undef, double undef, i32 %x
  %nxv16f64 = insertelement <vscale x 16 x double> undef, double undef, i32 %x

  ret void
}