xref: /llvm-project/llvm/test/CodeGen/X86/volatile.ll (revision 2f448bf509432c1a19ec46ab8cbc7353c03c6280)
1; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
2; RUN: llc < %s -mtriple=i686-- -mattr=sse2 | FileCheck %s --check-prefixes=ALL,OPT
3; RUN: llc < %s -mtriple=i686-- -mattr=sse2 -O0 | FileCheck %s --check-prefixes=ALL,NOOPT
4
5@x = external dso_local global double
6
7define void @foo() nounwind  {
8; OPT-LABEL: foo:
9; OPT:       # %bb.0:
10; OPT-NEXT:    movsd {{.*#+}} xmm0 = mem[0],zero
11; OPT-NEXT:    xorps %xmm0, %xmm0
12; OPT-NEXT:    movsd %xmm0, x
13; OPT-NEXT:    movsd %xmm0, x
14; OPT-NEXT:    movsd {{.*#+}} xmm0 = mem[0],zero
15; OPT-NEXT:    retl
16;
17; NOOPT-LABEL: foo:
18; NOOPT:       # %bb.0:
19; NOOPT-NEXT:    movsd {{.*#+}} xmm0 = mem[0],zero
20; NOOPT-NEXT:    xorps %xmm0, %xmm0
21; NOOPT-NEXT:    movsd %xmm0, x
22; NOOPT-NEXT:    xorps %xmm0, %xmm0
23; NOOPT-NEXT:    movsd %xmm0, x
24; NOOPT-NEXT:    movsd {{.*#+}} xmm0 = mem[0],zero
25; NOOPT-NEXT:    retl
26  %a = load volatile double, ptr @x
27  store volatile double 0.0, ptr @x
28  store volatile double 0.0, ptr @x
29  %b = load volatile double, ptr @x
30  ret void
31}
32
33define void @bar() nounwind  {
34; ALL-LABEL: bar:
35; ALL:       # %bb.0:
36; ALL-NEXT:    movsd {{.*#+}} xmm0 = mem[0],zero
37; ALL-NEXT:    retl
38  %c = load volatile double, ptr @x
39  ret void
40}
41