1 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
2 ; RUN: llc -mtriple=x86_64-apple-darwin < %s | FileCheck %s
4 ; This test checks that we don't try to narrow the volatile load by selecting
5 ; the pattern below into a testb instruction.
7 define void @testb_volatile(ptr%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)
16 ; CHECK-NEXT: LBB0_1: ## %bb2
17 ; CHECK-NEXT: movl $0, (%rax)
20 %ptr = load ptr, ptr %ptrptr, align 8
21 %vol_load = load volatile i32, ptr %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
27 store i32 0, ptr%ptr, align 4
31 store i32 1, ptr%ptr, align 4