Skip to content

Commit 37cfd25

Browse files
committed
Was this just an LLVM bug?
1 parent 4282576 commit 37cfd25

File tree

3 files changed

+24
-36
lines changed

3 files changed

+24
-36
lines changed

.github/workflows/ci.yml

+9
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,15 @@ jobs:
6565
- name: x86_64-gnu-tools
6666
os: ubuntu-20.04-16core-64gb
6767
env: {}
68+
- name: dist-powerpc-linux
69+
os: ubuntu-20.04-8core-32gb
70+
env: {}
71+
- name: dist-powerpc64-linux
72+
os: ubuntu-20.04-8core-32gb
73+
env: {}
74+
- name: dist-powerpc64le-linux
75+
os: ubuntu-20.04-8core-32gb
76+
env: {}
6877
defaults:
6978
run:
7079
shell: "${{ contains(matrix.os, 'windows') && 'msys2 {0}' || 'bash' }}"

compiler/rustc_codegen_ssa/src/mir/intrinsic.rs

+6-36
Original file line numberDiff line numberDiff line change
@@ -352,12 +352,6 @@ impl<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>> FunctionCx<'a, 'tcx, Bx> {
352352
let dst = args[0].immediate();
353353
let mut cmp = args[1].immediate();
354354
let mut src = args[2].immediate();
355-
if ty.is_unsafe_ptr() {
356-
// Some platforms do not support atomic operations on pointers,
357-
// so we cast to integer first.
358-
cmp = bx.ptrtoint(cmp, bx.type_isize());
359-
src = bx.ptrtoint(src, bx.type_isize());
360-
}
361355
let (val, success) = bx.atomic_cmpxchg(
362356
dst,
363357
cmp,
@@ -385,26 +379,12 @@ impl<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>> FunctionCx<'a, 'tcx, Bx> {
385379
let layout = bx.layout_of(ty);
386380
let size = layout.size;
387381
let source = args[0].immediate();
388-
if ty.is_unsafe_ptr() {
389-
// Some platforms do not support atomic operations on pointers,
390-
// so we cast to integer first...
391-
let llty = bx.type_isize();
392-
let result = bx.atomic_load(
393-
llty,
394-
source,
395-
parse_ordering(bx, ordering),
396-
size,
397-
);
398-
// ... and then cast the result back to a pointer
399-
bx.inttoptr(result, bx.backend_type(layout))
400-
} else {
401-
bx.atomic_load(
402-
bx.backend_type(layout),
403-
source,
404-
parse_ordering(bx, ordering),
405-
size,
406-
)
407-
}
382+
bx.atomic_load(
383+
bx.backend_type(layout),
384+
source,
385+
parse_ordering(bx, ordering),
386+
size,
387+
)
408388
} else {
409389
invalid_monomorphization(ty);
410390
return Ok(());
@@ -417,11 +397,6 @@ impl<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>> FunctionCx<'a, 'tcx, Bx> {
417397
let size = bx.layout_of(ty).size;
418398
let mut val = args[1].immediate();
419399
let ptr = args[0].immediate();
420-
if ty.is_unsafe_ptr() {
421-
// Some platforms do not support atomic operations on pointers,
422-
// so we cast to integer first.
423-
val = bx.ptrtoint(val, bx.type_isize());
424-
}
425400
bx.atomic_store(val, ptr, parse_ordering(bx, ordering), size);
426401
} else {
427402
invalid_monomorphization(ty);
@@ -466,11 +441,6 @@ impl<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>> FunctionCx<'a, 'tcx, Bx> {
466441
if int_type_width_signed(ty, bx.tcx()).is_some() || ty.is_unsafe_ptr() {
467442
let ptr = args[0].immediate();
468443
let mut val = args[1].immediate();
469-
if ty.is_unsafe_ptr() {
470-
// Some platforms do not support atomic operations on pointers,
471-
// so we cast to integer first.
472-
val = bx.ptrtoint(val, bx.type_isize());
473-
}
474444
bx.atomic_rmw(atom_op, ptr, val, parse_ordering(bx, ordering))
475445
} else {
476446
invalid_monomorphization(ty);

src/ci/github-actions/ci.yml

+9
Original file line numberDiff line numberDiff line change
@@ -365,6 +365,15 @@ jobs:
365365
- name: x86_64-gnu-tools
366366
<<: *job-linux-16c
367367

368+
- name: dist-powerpc-linux
369+
<<: *job-linux-8c
370+
371+
- name: dist-powerpc64-linux
372+
<<: *job-linux-8c
373+
374+
- name: dist-powerpc64le-linux
375+
<<: *job-linux-8c
376+
368377
auto:
369378
<<: *base-ci-job
370379
name: auto - ${{ matrix.name }}

0 commit comments

Comments
 (0)