File tree Expand file tree Collapse file tree 2 files changed +18
-4
lines changed Expand file tree Collapse file tree 2 files changed +18
-4
lines changed Original file line number Diff line number Diff line change @@ -232,19 +232,19 @@ static Value *MakeBinaryAtomicValue(
232
232
233
233
static Value *EmitNontemporalStore(CodeGenFunction &CGF, const CallExpr *E) {
234
234
Value *Val = CGF.EmitScalarExpr(E->getArg(0));
235
- Value * Address = CGF.EmitScalarExpr (E->getArg(1));
235
+ Address Addr = CGF.EmitPointerWithAlignment (E->getArg(1));
236
236
237
237
Val = CGF.EmitToMemory(Val, E->getArg(0)->getType());
238
- LValue LV = CGF.MakeNaturalAlignAddrLValue(Address , E->getArg(0)->getType());
238
+ LValue LV = CGF.MakeAddrLValue(Addr , E->getArg(0)->getType());
239
239
LV.setNontemporal(true);
240
240
CGF.EmitStoreOfScalar(Val, LV, false);
241
241
return nullptr;
242
242
}
243
243
244
244
static Value *EmitNontemporalLoad(CodeGenFunction &CGF, const CallExpr *E) {
245
- Value * Address = CGF.EmitScalarExpr (E->getArg(0));
245
+ Address Addr = CGF.EmitPointerWithAlignment (E->getArg(0));
246
246
247
- LValue LV = CGF.MakeNaturalAlignAddrLValue(Address , E->getType());
247
+ LValue LV = CGF.MakeAddrLValue(Addr , E->getType());
248
248
LV.setNontemporal(true);
249
249
return CGF.EmitLoadOfScalar(LV, E->getExprLoc());
250
250
}
Original file line number Diff line number Diff line change @@ -46,3 +46,17 @@ void test_all_sizes(void) // CHECK-LABEL: test_all_sizes
46
46
vf2 = __builtin_nontemporal_load (&vf1); // CHECK: load <4 x float>{{.*}}align 16, !nontemporal
47
47
vc2 = __builtin_nontemporal_load (&vc1); // CHECK: load <8 x i8>{{.*}}align 8, !nontemporal
48
48
}
49
+
50
+ struct S { char c[16 ]; };
51
+ S x;
52
+
53
+ typedef int v4si __attribute__ ((vector_size(16 )));
54
+
55
+ // CHECK-LABEL: define void @_Z14test_alignmentv()
56
+ // CHECK: load <4 x i32>, ptr @x, align 1, !nontemporal
57
+ // CHECK: store <4 x i32> %1, ptr @x, align 1, !nontemporal
58
+
59
+ void test_alignment () {
60
+ auto t = __builtin_nontemporal_load ((v4si*)x.c );
61
+ __builtin_nontemporal_store (t, (v4si*)x.c );
62
+ }
You can’t perform that action at this time.
0 commit comments