@@ -960,6 +960,15 @@ pub(super) fn codegen_simd_intrinsic_call<'tcx>(
960
960
let lane_clif_ty = fx. clif_type ( val_lane_ty) . unwrap ( ) ;
961
961
let ptr_val = ptr. load_scalar ( fx) ;
962
962
963
+ let alignment = generic_args[ 3 ] . expect_const ( ) . to_value ( ) . valtree . unwrap_branch ( ) [ 0 ]
964
+ . unwrap_leaf ( )
965
+ . to_simd_alignment ( ) ;
966
+
967
+ let memflags = match alignment {
968
+ SimdAlign :: Unaligned => MemFlags :: new ( ) . with_notrap ( ) ,
969
+ _ => MemFlags :: trusted ( ) ,
970
+ } ;
971
+
963
972
for lane_idx in 0 ..val_lane_count {
964
973
let val_lane = val. value_lane ( fx, lane_idx) . load_scalar ( fx) ;
965
974
let mask_lane = mask. value_lane ( fx, lane_idx) . load_scalar ( fx) ;
@@ -972,7 +981,7 @@ pub(super) fn codegen_simd_intrinsic_call<'tcx>(
972
981
973
982
fx. bcx . switch_to_block ( if_enabled) ;
974
983
let offset = lane_idx as i32 * lane_clif_ty. bytes ( ) as i32 ;
975
- fx. bcx . ins ( ) . store ( MemFlags :: trusted ( ) , val_lane, ptr_val, Offset32 :: new ( offset) ) ;
984
+ fx. bcx . ins ( ) . store ( memflags , val_lane, ptr_val, Offset32 :: new ( offset) ) ;
976
985
fx. bcx . ins ( ) . jump ( next, & [ ] ) ;
977
986
978
987
fx. bcx . seal_block ( next) ;
@@ -996,6 +1005,15 @@ pub(super) fn codegen_simd_intrinsic_call<'tcx>(
996
1005
let lane_clif_ty = fx. clif_type ( val_lane_ty) . unwrap ( ) ;
997
1006
let ret_lane_layout = fx. layout_of ( ret_lane_ty) ;
998
1007
1008
+ let alignment = generic_args[ 3 ] . expect_const ( ) . to_value ( ) . valtree . unwrap_branch ( ) [ 0 ]
1009
+ . unwrap_leaf ( )
1010
+ . to_simd_alignment ( ) ;
1011
+
1012
+ let memflags = match alignment {
1013
+ SimdAlign :: Unaligned => MemFlags :: new ( ) . with_notrap ( ) ,
1014
+ _ => MemFlags :: trusted ( ) ,
1015
+ } ;
1016
+
999
1017
for lane_idx in 0 ..ptr_lane_count {
1000
1018
let val_lane = val. value_lane ( fx, lane_idx) . load_scalar ( fx) ;
1001
1019
let ptr_lane = ptr. value_lane ( fx, lane_idx) . load_scalar ( fx) ;
@@ -1011,7 +1029,7 @@ pub(super) fn codegen_simd_intrinsic_call<'tcx>(
1011
1029
fx. bcx . seal_block ( if_disabled) ;
1012
1030
1013
1031
fx. bcx . switch_to_block ( if_enabled) ;
1014
- let res = fx. bcx . ins ( ) . load ( lane_clif_ty, MemFlags :: trusted ( ) , ptr_lane, 0 ) ;
1032
+ let res = fx. bcx . ins ( ) . load ( lane_clif_ty, memflags , ptr_lane, 0 ) ;
1015
1033
fx. bcx . ins ( ) . jump ( next, & [ res. into ( ) ] ) ;
1016
1034
1017
1035
fx. bcx . switch_to_block ( if_disabled) ;
0 commit comments