@@ -7514,36 +7514,26 @@ Value *CodeGenFunction::EmitX86BuiltinExpr(unsigned BuiltinID,
7514
7514
}
7515
7515
7516
7516
case X86::BI__builtin_ia32_movnti:
7517
- case X86::BI__builtin_ia32_movnti64: {
7518
- llvm::MDNode *Node = llvm::MDNode::get (
7519
- getLLVMContext (), llvm::ConstantAsMetadata::get (Builder.getInt32 (1 )));
7520
-
7521
- // Convert the type of the pointer to a pointer to the stored type.
7522
- Value *BC = Builder.CreateBitCast (Ops[0 ],
7523
- llvm::PointerType::getUnqual (Ops[1 ]->getType ()),
7524
- " cast" );
7525
- StoreInst *SI = Builder.CreateDefaultAlignedStore (Ops[1 ], BC);
7526
- SI->setMetadata (CGM.getModule ().getMDKindID (" nontemporal" ), Node);
7527
-
7528
- // No alignment for scalar intrinsic store.
7529
- SI->setAlignment (1 );
7530
- return SI;
7531
- }
7517
+ case X86::BI__builtin_ia32_movnti64:
7532
7518
case X86::BI__builtin_ia32_movntsd:
7533
7519
case X86::BI__builtin_ia32_movntss: {
7534
7520
llvm::MDNode *Node = llvm::MDNode::get (
7535
7521
getLLVMContext (), llvm::ConstantAsMetadata::get (Builder.getInt32 (1 )));
7536
7522
7523
+ Value *Ptr = Ops[0 ];
7524
+ Value *Src = Ops[1 ];
7525
+
7537
7526
// Extract the 0'th element of the source vector.
7538
- Value *Scl = Builder.CreateExtractElement (Ops[1 ], (uint64_t )0 , " extract" );
7527
+ if (BuiltinID == X86::BI__builtin_ia32_movntsd ||
7528
+ BuiltinID == X86::BI__builtin_ia32_movntss)
7529
+ Src = Builder.CreateExtractElement (Src, (uint64_t )0 , " extract" );
7539
7530
7540
7531
// Convert the type of the pointer to a pointer to the stored type.
7541
- Value *BC = Builder.CreateBitCast (Ops[0 ],
7542
- llvm::PointerType::getUnqual (Scl->getType ()),
7543
- " cast" );
7532
+ Value *BC = Builder.CreateBitCast (
7533
+ Ptr, llvm::PointerType::getUnqual (Src->getType ()), " cast" );
7544
7534
7545
7535
// Unaligned nontemporal store of the scalar value.
7546
- StoreInst *SI = Builder.CreateDefaultAlignedStore (Scl , BC);
7536
+ StoreInst *SI = Builder.CreateDefaultAlignedStore (Src , BC);
7547
7537
SI->setMetadata (CGM.getModule ().getMDKindID (" nontemporal" ), Node);
7548
7538
SI->setAlignment (1 );
7549
7539
return SI;
0 commit comments