@@ -2887,22 +2887,22 @@ static bool interp__builtin_vec_ext(InterpState &S, CodePtr OpPC,
28872887 if (!Vec.getFieldDesc ()->isPrimitiveArray ())
28882888 return false ;
28892889
2890- unsigned NumElts = Vec.getNumElems ();
2891- unsigned Index = static_cast <unsigned >(ImmAPS.getZExtValue () & (NumElts - 1 ));
2890+ unsigned NumElems = Vec.getNumElems ();
2891+ unsigned Index =
2892+ static_cast <unsigned >(ImmAPS.getZExtValue () & (NumElems - 1 ));
28922893
2893- switch (ID) {
2894- case X86::BI__builtin_ia32_vec_ext_v4sf:
2894+ PrimType ElemPT = Vec.getFieldDesc ()->getPrimType ();
2895+ // FIXME(#161685): Replace float+int split with a numeric-only type switch
2896+ if (ElemPT == PT_Float) {
28952897 S.Stk .push <Floating>(Vec.elem <Floating>(Index));
28962898 return true ;
2897- default : {
2898- PrimType ElemPT = Vec.getFieldDesc ()->getPrimType ();
2899- INT_TYPE_SWITCH_NO_BOOL (ElemPT, {
2900- APSInt V = Vec.elem <T>(Index).toAPSInt ();
2901- pushInteger (S, V, Call->getType ());
2902- });
2903- return true ;
2904- }
29052899 }
2900+ INT_TYPE_SWITCH_NO_BOOL (ElemPT, {
2901+ APSInt V = Vec.elem <T>(Index).toAPSInt ();
2902+ pushInteger (S, V, Call->getType ());
2903+ });
2904+
2905+ return true ;
29062906}
29072907
29082908static bool interp__builtin_vec_set (InterpState &S, CodePtr OpPC,
@@ -2918,12 +2918,13 @@ static bool interp__builtin_vec_set(InterpState &S, CodePtr OpPC,
29182918
29192919 const Pointer &Dst = S.Stk .peek <Pointer>();
29202920
2921- unsigned NumElts = Base.getNumElems ();
2922- unsigned Index = static_cast <unsigned >(ImmAPS.getZExtValue () & (NumElts - 1 ));
2921+ unsigned NumElems = Base.getNumElems ();
2922+ unsigned Index =
2923+ static_cast <unsigned >(ImmAPS.getZExtValue () & (NumElems - 1 ));
29232924
29242925 PrimType ElemPT = Base.getFieldDesc ()->getPrimType ();
29252926 INT_TYPE_SWITCH_NO_BOOL (ElemPT, {
2926- for (unsigned I = 0 ; I != NumElts ; ++I)
2927+ for (unsigned I = 0 ; I != NumElems ; ++I)
29272928 Dst.elem <T>(I) = Base.elem <T>(I);
29282929 Dst.elem <T>(Index) = static_cast <T>(ValAPS);
29292930 });
0 commit comments