@@ -544,19 +544,6 @@ static Value *expandRadiansIntrinsic(CallInst *Orig) {
544544 return Builder.CreateFMul (X, PiOver180);
545545}
546546
547- static Value *createCombinedi32toi64Expansion (IRBuilder<> &Builder,
548- Value *LoBytes,
549- Value *HighBytes) {
550- // For int64, manually combine two int32s
551- // First, zero-extend both values to i64
552- Value *Lo = Builder.CreateZExt (LoBytes, Builder.getInt64Ty ());
553- Value *Hi = Builder.CreateZExt (HighBytes, Builder.getInt64Ty ());
554- // Shift the high bits left by 32 bits
555- Value *ShiftedHi = Builder.CreateShl (Hi, Builder.getInt64 (32 ));
556- // OR the high and low bits together
557- return Builder.CreateOr (Lo, ShiftedHi);
558- }
559-
560547static bool expandTypedBufferLoadIntrinsic (CallInst *Orig) {
561548 IRBuilder<> Builder (Orig);
562549
@@ -597,9 +584,17 @@ static bool expandTypedBufferLoadIntrinsic(CallInst *Orig) {
597584 Combined =
598585 Builder.CreateIntrinsic (Builder.getDoubleTy (), Intrinsic::dx_asdouble,
599586 {ExtractElements[I], ExtractElements[I + 1 ]});
600- else
601- Combined = createCombinedi32toi64Expansion (Builder, ExtractElements[I],
602- ExtractElements[I + 1 ]);
587+ else {
588+ // For int64, manually combine two int32s
589+ // First, zero-extend both values to i64
590+ Value *Lo = Builder.CreateZExt (ExtractElements[I], Builder.getInt64Ty ());
591+ Value *Hi =
592+ Builder.CreateZExt (ExtractElements[I + 1 ], Builder.getInt64Ty ());
593+ // Shift the high bits left by 32 bits
594+ Value *ShiftedHi = Builder.CreateShl (Hi, Builder.getInt64 (32 ));
595+ // OR the high and low bits together
596+ Combined = Builder.CreateOr (Lo, ShiftedHi);
597+ }
603598
604599 if (ExtractNum == 4 )
605600 Result = Builder.CreateInsertElement (Result, Combined,
0 commit comments