@@ -544,12 +544,13 @@ static Value *expandRadiansIntrinsic(CallInst *Orig) {
544
544
return Builder.CreateFMul (X, PiOver180);
545
545
}
546
546
547
- static Value* createCombinedi32toi64Expansion (IRBuilder<> &Builder, Value *LoBytes, Value *HighBytes) {
547
+ static Value *createCombinedi32toi64Expansion (IRBuilder<> &Builder,
548
+ Value *LoBytes,
549
+ Value *HighBytes) {
548
550
// For int64, manually combine two int32s
549
551
// First, zero-extend both values to i64
550
552
Value *Lo = Builder.CreateZExt (LoBytes, Builder.getInt64Ty ());
551
- Value *Hi =
552
- Builder.CreateZExt (HighBytes, Builder.getInt64Ty ());
553
+ Value *Hi = Builder.CreateZExt (HighBytes, Builder.getInt64Ty ());
553
554
// Shift the high bits left by 32 bits
554
555
Value *ShiftedHi = Builder.CreateShl (Hi, Builder.getInt64 (32 ));
555
556
// OR the high and low bits together
@@ -591,14 +592,14 @@ static bool expandTypedBufferLoadIntrinsic(CallInst *Orig) {
591
592
Value *Result = PoisonValue::get (BufferTy);
592
593
for (unsigned I = 0 ; I < ExtractNum; I += 2 ) {
593
594
Value *Combined = nullptr ;
594
- if (IsDouble)
595
+ if (IsDouble)
595
596
// For doubles, use dx_asdouble intrinsic
596
597
Combined =
597
598
Builder.CreateIntrinsic (Builder.getDoubleTy (), Intrinsic::dx_asdouble,
598
599
{ExtractElements[I], ExtractElements[I + 1 ]});
599
600
else
600
- Combined =
601
- createCombinedi32toi64Expansion (Builder, ExtractElements[I], ExtractElements[I + 1 ]);
601
+ Combined = createCombinedi32toi64Expansion (Builder, ExtractElements[I],
602
+ ExtractElements[I + 1 ]);
602
603
603
604
if (ExtractNum == 4 )
604
605
Result = Builder.CreateInsertElement (Result, Combined,
@@ -654,7 +655,7 @@ static bool expandTypedBufferStoreIntrinsic(CallInst *Orig) {
654
655
Type *Int32Ty = Builder.getInt32Ty ();
655
656
Type *ResultTy = VectorType::get (Int32Ty, IsVector ? 4 : 2 , false );
656
657
Value *Val = PoisonValue::get (ResultTy);
657
-
658
+
658
659
// Handle double type(s)
659
660
Type *SplitElementTy = Int32Ty;
660
661
if (IsVector)
@@ -672,7 +673,7 @@ static bool expandTypedBufferStoreIntrinsic(CallInst *Orig) {
672
673
} else {
673
674
// Handle int64 type(s)
674
675
Value *InputVal = Orig->getOperand (2 );
675
- Constant *ShiftAmt = Builder.getInt64 (32 );
676
+ Constant *ShiftAmt = Builder.getInt64 (32 );
676
677
if (IsVector)
677
678
ShiftAmt = ConstantVector::getSplat (ElementCount::getFixed (2 ), ShiftAmt);
678
679
@@ -683,13 +684,13 @@ static bool expandTypedBufferStoreIntrinsic(CallInst *Orig) {
683
684
}
684
685
685
686
if (IsVector) {
686
- // For vector doubles, use shuffle to create the final vector
687
- Val = Builder.CreateShuffleVector (LowBits, HighBits, {0 , 2 , 1 , 3 });
688
- } else {
689
- // For scalar doubles, insert the elements
690
- Val = Builder.CreateInsertElement (Val, LowBits, Builder.getInt32 (0 ));
691
- Val = Builder.CreateInsertElement (Val, HighBits, Builder.getInt32 (1 ));
692
- }
687
+ // For vector doubles, use shuffle to create the final vector
688
+ Val = Builder.CreateShuffleVector (LowBits, HighBits, {0 , 2 , 1 , 3 });
689
+ } else {
690
+ // For scalar doubles, insert the elements
691
+ Val = Builder.CreateInsertElement (Val, LowBits, Builder.getInt32 (0 ));
692
+ Val = Builder.CreateInsertElement (Val, HighBits, Builder.getInt32 (1 ));
693
+ }
693
694
694
695
// Create the final intrinsic call
695
696
Builder.CreateIntrinsic (Builder.getVoidTy (),
0 commit comments