• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
2; RUN: llc < %s -mtriple=i386-unknown-unknown -mattr=+sse2 | FileCheck %s --check-prefix=X32
3; RUN: llc < %s -mtriple=x86_64-unknown-unknown -mattr=-sse2 | FileCheck %s --check-prefix=X64
4
5; It doesn't matter if an x86-64 target has specified "no-sse2"; we still can use mfence.
6
7define void @test() {
8; X32-LABEL: test:
9; X32:       # %bb.0:
10; X32-NEXT:    mfence
11; X32-NEXT:    retl
12;
13; X64-LABEL: test:
14; X64:       # %bb.0:
15; X64-NEXT:    mfence
16; X64-NEXT:    retq
17  fence seq_cst
18  ret void
19}
20
21define i32 @fence(i32* %ptr) {
22; X32-LABEL: fence:
23; X32:       # %bb.0:
24; X32-NEXT:    movl {{[0-9]+}}(%esp), %eax
25; X32-NEXT:    mfence
26; X32-NEXT:    movl (%eax), %eax
27; X32-NEXT:    retl
28;
29; X64-LABEL: fence:
30; X64:       # %bb.0:
31; X64-NEXT:    mfence
32; X64-NEXT:    movl (%rdi), %eax
33; X64-NEXT:    retq
34  %atomic = atomicrmw add i32* %ptr, i32 0 seq_cst
35  ret i32 %atomic
36}
37
38