• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
2; RUN: llc -mtriple=x86_64-apple-darwin < %s | FileCheck %s
3
4; This test checks that we don't try to narrow the volatile load by selecting
5; the pattern below into a testb instruction.
6
7define void @testb_volatile(i32 **%ptrptr) {
8; CHECK-LABEL: testb_volatile:
9; CHECK:       ## %bb.0: ## %entry
10; CHECK-NEXT:    movq (%rdi), %rax
11; CHECK-NEXT:    testl $1, (%rax)
12; CHECK-NEXT:    jne LBB0_1
13; CHECK-NEXT:  ## %bb.2: ## %exit
14; CHECK-NEXT:    movl $1, (%rax)
15; CHECK-NEXT:    retq
16; CHECK-NEXT:  LBB0_1: ## %bb2
17; CHECK-NEXT:    movl $0, (%rax)
18; CHECK-NEXT:    retq
19entry:
20  %ptr = load i32*, i32** %ptrptr, align 8
21  %vol_load = load volatile i32, i32* %ptr, align 4
22  %and = and i32 %vol_load, 1
23  %cmp = icmp eq i32 %and, 0
24  br i1 %cmp, label %exit, label %bb2
25
26bb2:
27  store i32 0, i32 *%ptr, align 4
28  ret void
29
30exit:
31  store i32 1, i32 *%ptr, align 4
32  ret void
33}
34