@@ -70,175 +70,176 @@ enum HWIntrinsicCategory : uint8_t
70
70
#else
71
71
#error Unsupported platform
72
72
#endif
73
+
73
74
enum HWIntrinsicFlag : unsigned int
74
75
{
75
76
HW_Flag_NoFlag = 0 ,
76
77
77
78
// Commutative
78
79
// - if a binary-op intrinsic is commutative (e.g., Add, Multiply), its op1 can be contained
79
- HW_Flag_Commutative = 0x1 ,
80
+ HW_Flag_Commutative = ( unsigned int )( 1 << 1 ) ,
80
81
81
82
// NoCodeGen
82
83
// - should be transformed in the compiler front-end, cannot reach CodeGen
83
- HW_Flag_NoCodeGen = 0x2 ,
84
+ HW_Flag_NoCodeGen = ( 1 << 2 ) ,
84
85
85
86
// Multi-instruction
86
87
// - that one intrinsic can generate multiple instructions
87
- HW_Flag_MultiIns = 0x4 ,
88
+ HW_Flag_MultiIns = ( 1 << 3 ) ,
88
89
89
90
// Select base type using the first argument type
90
- HW_Flag_BaseTypeFromFirstArg = 0x8 ,
91
+ HW_Flag_BaseTypeFromFirstArg = ( 1 << 4 ) ,
91
92
92
93
// Select base type using the second argument type
93
- HW_Flag_BaseTypeFromSecondArg = 0x10 ,
94
+ HW_Flag_BaseTypeFromSecondArg = ( 1 << 5 ) ,
94
95
95
96
// Indicates compFloatingPointUsed does not need to be set.
96
- HW_Flag_NoFloatingPointUsed = 0x20 ,
97
+ HW_Flag_NoFloatingPointUsed = ( 1 << 6 ) ,
97
98
98
99
// NoJmpTable IMM
99
100
// the imm intrinsic does not need jumptable fallback when it gets non-const argument
100
- HW_Flag_NoJmpTableIMM = 0x40 ,
101
+ HW_Flag_NoJmpTableIMM = ( 1 << 7 ) ,
101
102
102
103
// Special codegen
103
104
// the intrinsics need special rules in CodeGen,
104
105
// but may be table-driven in the front-end
105
- HW_Flag_SpecialCodeGen = 0x80 ,
106
+ HW_Flag_SpecialCodeGen = ( 1 << 8 ) ,
106
107
107
108
// Special import
108
109
// the intrinsics need special rules in importer,
109
110
// but may be table-driven in the back-end
110
- HW_Flag_SpecialImport = 0x100 ,
111
+ HW_Flag_SpecialImport = ( 1 << 9 ) ,
111
112
112
113
// The intrinsic returns result in multiple registers.
113
- HW_Flag_MultiReg = 0x200 ,
114
+ HW_Flag_MultiReg = (1 << 10 ),
115
+
116
+ // The intrinsic has some barrier special side effect that should be tracked
117
+ HW_Flag_SpecialSideEffect_Barrier = (1 << 11 ),
118
+
119
+ // The intrinsic has some other special side effect that should be tracked
120
+ HW_Flag_SpecialSideEffect_Other = (1 << 12 ),
121
+
122
+ HW_Flag_SpecialSideEffectMask = (HW_Flag_SpecialSideEffect_Barrier | HW_Flag_SpecialSideEffect_Other),
114
123
115
- // The below is for defining platform-specific flags
124
+ // MaybeNoJmpTable IMM
125
+ // the imm intrinsic may not need jumptable fallback when it gets non-const argument
126
+ HW_Flag_MaybeNoJmpTableIMM = (1 << 13 ),
127
+
128
+ HW_Flag_CanBenefitFromConstantProp = (1 << 14 ),
129
+
130
+ // Used as a base for shifting the platform specific flags.
131
+ HW_Flag_PlatformBase = 14 ,
132
+ #define HW_TARGET_FLAG (id ) (unsigned int )(1 << (id + HW_Flag_PlatformBase))
133
+
134
+ // Platform-specific flags
116
135
#if defined(TARGET_XARCH)
117
136
// Full range IMM intrinsic
118
137
// - the immediate value is valid on the full range of imm8 (0-255)
119
- HW_Flag_FullRangeIMM = 0x400 ,
138
+ HW_Flag_FullRangeIMM = HW_TARGET_FLAG ( 1 ) ,
120
139
121
140
// Maybe IMM
122
141
// the intrinsic has either imm or Vector overloads
123
- HW_Flag_MaybeIMM = 0x800 ,
142
+ HW_Flag_MaybeIMM = HW_TARGET_FLAG ( 2 ) ,
124
143
125
144
// Copy Upper bits
126
145
// some SIMD scalar intrinsics need the semantics of copying upper bits from the source operand
127
- HW_Flag_CopyUpperBits = 0x1000 ,
146
+ HW_Flag_CopyUpperBits = HW_TARGET_FLAG ( 3 ) ,
128
147
129
148
// Maybe Memory Load/Store
130
149
// - some intrinsics may have pointer overloads but without HW_Category_MemoryLoad/HW_Category_MemoryStore
131
- HW_Flag_MaybeMemoryLoad = 0x2000 ,
132
- HW_Flag_MaybeMemoryStore = 0x4000 ,
150
+ HW_Flag_MaybeMemoryLoad = HW_TARGET_FLAG ( 4 ) ,
151
+ HW_Flag_MaybeMemoryStore = HW_TARGET_FLAG ( 5 ) ,
133
152
134
153
// No Read/Modify/Write Semantics
135
154
// the intrinsic doesn't have read/modify/write semantics in two/three-operand form.
136
- HW_Flag_NoRMWSemantics = 0x8000 ,
155
+ HW_Flag_NoRMWSemantics = HW_TARGET_FLAG ( 6 ) ,
137
156
138
157
// NoContainment
139
158
// the intrinsic cannot be handled by containment,
140
159
// all the intrinsic that have explicit memory load/store semantics should have this flag
141
- HW_Flag_NoContainment = 0x10000 ,
160
+ HW_Flag_NoContainment = HW_TARGET_FLAG ( 7 ) ,
142
161
143
162
// Returns Per-Element Mask
144
163
// the intrinsic returns a vector containing elements that are either "all bits set" or "all bits clear"
145
164
// this output can be used as a per-element mask
146
- HW_Flag_ReturnsPerElementMask = 0x20000 ,
165
+ HW_Flag_ReturnsPerElementMask = HW_TARGET_FLAG ( 8 ) ,
147
166
148
167
// AvxOnlyCompatible
149
168
// the intrinsic can be used on hardware with AVX but not AVX2 support
150
- HW_Flag_AvxOnlyCompatible = 0x40000 ,
169
+ HW_Flag_AvxOnlyCompatible = HW_TARGET_FLAG ( 9 ) ,
151
170
152
171
// MaybeCommutative
153
172
// - if a binary-op intrinsic is maybe commutative (e.g., Max or Min for float/double), its op1 can possibly be
154
173
// contained
155
- HW_Flag_MaybeCommutative = 0x80000 ,
174
+ HW_Flag_MaybeCommutative = HW_TARGET_FLAG ( 10 ) ,
156
175
157
176
// The intrinsic has no EVEX compatible form
158
- HW_Flag_NoEvexSemantics = 0x100000 ,
177
+ HW_Flag_NoEvexSemantics = HW_TARGET_FLAG (11 ),
178
+
179
+ // The intrinsic is an RMW intrinsic
180
+ HW_Flag_RmwIntrinsic = HW_TARGET_FLAG (12 ),
181
+
182
+ // The intrinsic is a FusedMultiplyAdd intrinsic
183
+ HW_Flag_FmaIntrinsic = HW_TARGET_FLAG (13 ),
184
+
185
+ // The intrinsic is a PermuteVar2x intrinsic
186
+ HW_Flag_PermuteVar2x = HW_TARGET_FLAG (14 ),
187
+
188
+ // The intrinsic is an embedded broadcast compatible intrinsic
189
+ HW_Flag_EmbBroadcastCompatible = HW_TARGET_FLAG (15 ),
190
+
191
+ // The intrinsic is an embedded rounding compatible intrinsic
192
+ HW_Flag_EmbRoundingCompatible = HW_TARGET_FLAG (16 ),
193
+
194
+ // The intrinsic is an embedded masking incompatible intrinsic
195
+ HW_Flag_EmbMaskingIncompatible = HW_TARGET_FLAG (17 ),
159
196
160
197
#elif defined(TARGET_ARM64)
161
198
// The intrinsic has an immediate operand
162
199
// - the value can be (and should be) encoded in a corresponding instruction when the operand value is constant
163
- HW_Flag_HasImmediateOperand = 0x400 ,
200
+ HW_Flag_HasImmediateOperand = HW_TARGET_FLAG ( 1 ) ,
164
201
165
202
// The intrinsic has read/modify/write semantics in multiple-operands form.
166
- HW_Flag_HasRMWSemantics = 0x800 ,
203
+ HW_Flag_HasRMWSemantics = HW_TARGET_FLAG ( 2 ) ,
167
204
168
205
// The intrinsic operates on the lower part of a SIMD register
169
206
// - the upper part of the source registers are ignored
170
207
// - the upper part of the destination register is zeroed
171
- HW_Flag_SIMDScalar = 0x1000 ,
208
+ HW_Flag_SIMDScalar = HW_TARGET_FLAG ( 3 ) ,
172
209
173
210
// The intrinsic supports some sort of containment analysis
174
- HW_Flag_SupportsContainment = 0x2000 ,
211
+ HW_Flag_SupportsContainment = HW_TARGET_FLAG ( 4 ) ,
175
212
176
213
// The intrinsic needs consecutive registers
177
- HW_Flag_NeedsConsecutiveRegisters = 0x4000 ,
214
+ HW_Flag_NeedsConsecutiveRegisters = HW_TARGET_FLAG ( 5 ) ,
178
215
179
216
// The intrinsic uses scalable registers
180
- HW_Flag_Scalable = 0x8000 ,
217
+ HW_Flag_Scalable = HW_TARGET_FLAG ( 6 ) ,
181
218
182
219
// Returns Per-Element Mask
183
220
// the intrinsic returns a vector containing elements that are either "all bits set" or "all bits clear"
184
221
// this output can be used as a per-element mask
185
- HW_Flag_ReturnsPerElementMask = 0x10000 ,
222
+ HW_Flag_ReturnsPerElementMask = HW_TARGET_FLAG ( 7 ) ,
186
223
187
224
// The intrinsic uses a mask in arg1 to select elements present in the result
188
- HW_Flag_ExplicitMaskedOperation = 0x20000 ,
225
+ HW_Flag_ExplicitMaskedOperation = HW_TARGET_FLAG ( 8 ) ,
189
226
190
227
// The intrinsic uses a mask in arg1 to select elements present in the result, and must use a low register.
191
- HW_Flag_LowMaskedOperation = 0x40000 ,
228
+ HW_Flag_LowMaskedOperation = HW_TARGET_FLAG ( 9 ) ,
192
229
193
230
// The intrinsic can optionally use a mask in arg1 to select elements present in the result, which is not present in
194
231
// the API call
195
- HW_Flag_OptionalEmbeddedMaskedOperation = 0x80000 ,
232
+ HW_Flag_OptionalEmbeddedMaskedOperation = HW_TARGET_FLAG ( 10 ) ,
196
233
197
234
// The intrinsic uses a mask in arg1 to select elements present in the result, which is not present in the API call
198
- HW_Flag_EmbeddedMaskedOperation = 0x100000 ,
235
+ HW_Flag_EmbeddedMaskedOperation = HW_TARGET_FLAG (11 ),
236
+
237
+ // The intrinsic has an enum operand. Using this implies HW_Flag_HasImmediateOperand.
238
+ HW_Flag_HasEnumOperand = HW_TARGET_FLAG (12 ),
199
239
200
240
#else
201
241
#error Unsupported platform
202
242
#endif
203
-
204
- // The intrinsic has some barrier special side effect that should be tracked
205
- HW_Flag_SpecialSideEffect_Barrier = 0x200000 ,
206
-
207
- // The intrinsic has some other special side effect that should be tracked
208
- HW_Flag_SpecialSideEffect_Other = 0x400000 ,
209
-
210
- HW_Flag_SpecialSideEffectMask = (HW_Flag_SpecialSideEffect_Barrier | HW_Flag_SpecialSideEffect_Other),
211
-
212
- // MaybeNoJmpTable IMM
213
- // the imm intrinsic may not need jumptable fallback when it gets non-const argument
214
- HW_Flag_MaybeNoJmpTableIMM = 0x800000 ,
215
-
216
- #if defined(TARGET_XARCH)
217
- // The intrinsic is an RMW intrinsic
218
- HW_Flag_RmwIntrinsic = 0x1000000 ,
219
-
220
- // The intrinsic is a FusedMultiplyAdd intrinsic
221
- HW_Flag_FmaIntrinsic = 0x2000000 ,
222
-
223
- // The intrinsic is a PermuteVar2x intrinsic
224
- HW_Flag_PermuteVar2x = 0x4000000 ,
225
-
226
- // The intrinsic is an embedded broadcast compatible intrinsic
227
- HW_Flag_EmbBroadcastCompatible = 0x8000000 ,
228
-
229
- // The intrinsic is an embedded rounding compatible intrinsic
230
- HW_Flag_EmbRoundingCompatible = 0x10000000 ,
231
-
232
- // The intrinsic is an embedded masking incompatible intrinsic
233
- HW_Flag_EmbMaskingIncompatible = 0x20000000 ,
234
- #elif defined(TARGET_ARM64)
235
-
236
- // The intrinsic has an enum operand. Using this implies HW_Flag_HasImmediateOperand.
237
- HW_Flag_HasEnumOperand = 0x1000000 ,
238
-
239
- #endif // TARGET_XARCH
240
-
241
- HW_Flag_CanBenefitFromConstantProp = 0x80000000 ,
242
243
};
243
244
244
245
#if defined(TARGET_XARCH)
0 commit comments