-
-
Notifications
You must be signed in to change notification settings - Fork 15.4k
Fix unaligned_volatile_store by removing MemFlags::UNALIGNED
#158899
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -162,7 +162,28 @@ pub unsafe fn unaligned_volatile_load_fat(a: *const UninitFatPointer) -> UninitF | |
|
|
||
| // CHECK-LABEL: @unaligned_volatile_store | ||
| #[no_mangle] | ||
| pub unsafe fn unaligned_volatile_store(a: *mut u8, b: u8) { | ||
| // CHECK: store volatile | ||
| pub unsafe fn unaligned_volatile_store(a: *mut u16, b: u16) { | ||
| // CHECK: store volatile i16 %b, ptr %a, align 1 | ||
| intrinsics::unaligned_volatile_store(a, b) | ||
| } | ||
|
|
||
| // CHECK-LABEL: @unaligned_volatile_store_pair | ||
| #[no_mangle] | ||
| pub unsafe fn unaligned_volatile_store_pair(a: *mut (u16, u16), b: (u16, u16)) { | ||
| // CHECK: store volatile i16 %b.0, ptr %a, align 1 | ||
| // CHECK: [[TEMP:%.+]] = getelementptr inbounds i8, ptr %a, {{i16|i32|i64}} 2 | ||
| // CHECK: store volatile i16 %b.1, ptr [[TEMP]], align 1 | ||
| intrinsics::unaligned_volatile_store(a, b) | ||
| } | ||
|
|
||
| // CHECK-LABEL: @unaligned_volatile_store_array | ||
| #[no_mangle] | ||
| pub unsafe fn unaligned_volatile_store_array(a: *mut [u16; 7], b: [u16; 7]) { | ||
| // Note that only the store side is unaligned; the load from the argument is aligned. | ||
|
|
||
| // CHECK-NOT: memcpy | ||
| // CHECK: call void @llvm.memcpy{{.+}}(ptr align 1 %a, ptr align 2 %b, {{i16|i32|i64}} 14, i1 true) | ||
|
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. A volatile (See danlehmann/bitfield#136 for more -- it's looking at this problem that had me looking at volatile stores at all. I'll make another PR after this one to work on that problem.) |
||
| // CHECK-NOT: memcpy | ||
| // CHECK: ret void | ||
| intrinsics::unaligned_volatile_store(a, b) | ||
| } | ||
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Note that this test was essentially useless, since
u8which always has alignment1even if you don't useunaligned.So I expanded them to actually test things.
View changes since the review