@@ -1184,6 +1184,10 @@ static bool interp__builtin_ia32_bzhi(InterpState &S, CodePtr OpPC,
1184
1184
const InterpFrame *Frame,
1185
1185
const Function *Func,
1186
1186
const CallExpr *Call) {
1187
+ QualType CallType = Call->getType ();
1188
+ if (!CallType->isIntegerType ())
1189
+ return false ;
1190
+
1187
1191
PrimType ValT = *S.Ctx .classify (Call->getArg (0 ));
1188
1192
PrimType IndexT = *S.Ctx .classify (Call->getArg (1 ));
1189
1193
@@ -1197,7 +1201,7 @@ static bool interp__builtin_ia32_bzhi(InterpState &S, CodePtr OpPC,
1197
1201
if (Index < BitWidth)
1198
1202
Val.clearHighBits (BitWidth - Index);
1199
1203
1200
- pushInteger (S, Val, Call-> getType () );
1204
+ pushInteger (S, Val, CallType );
1201
1205
return true ;
1202
1206
}
1203
1207
@@ -1210,7 +1214,7 @@ static bool interp__builtin_ia32_lzcnt(InterpState &S, CodePtr OpPC,
1210
1214
return false ;
1211
1215
1212
1216
APSInt Val = peekToAPSInt (S.Stk , *S.Ctx .classify (Call->getArg (0 )));
1213
- pushInteger (S, Val.countLeadingZeros (), Call-> getType () );
1217
+ pushInteger (S, Val.countLeadingZeros (), CallType );
1214
1218
return true ;
1215
1219
}
1216
1220
@@ -1223,7 +1227,7 @@ static bool interp__builtin_ia32_tzcnt(InterpState &S, CodePtr OpPC,
1223
1227
return false ;
1224
1228
1225
1229
APSInt Val = peekToAPSInt (S.Stk , *S.Ctx .classify (Call->getArg (0 )));
1226
- pushInteger (S, Val.countTrailingZeros (), Call-> getType () );
1230
+ pushInteger (S, Val.countTrailingZeros (), CallType );
1227
1231
return true ;
1228
1232
}
1229
1233
0 commit comments