1 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
2 ; RUN: llc < %s -mtriple=x86_64-unknown-unknown -mattr=bmi | FileCheck %s
4 @a = external dso_local local_unnamed_addr global i32, align 4
5 @f = external dso_local local_unnamed_addr global i32, align 4
7 define void @g(ptr %x, ptr %y, ptr %z) {
9 ; CHECK: # %bb.0: # %entry
10 ; CHECK-NEXT: movl a(%rip), %eax
13 ; CHECK-NEXT: xorl %ecx, %ecx
14 ; CHECK-NEXT: testl %eax, %eax
15 ; CHECK-NEXT: sete %cl
16 ; CHECK-NEXT: addl %ecx, %ecx
17 ; CHECK-NEXT: orl (%rdi), %ecx
18 ; CHECK-NEXT: movl $0, (%rsi)
21 ; CHECK-NEXT: shll $8, %eax
22 ; CHECK-NEXT: bextrl %eax, f(%rip), %eax
23 ; CHECK-NEXT: orl %ecx, %eax
24 ; CHECK-NEXT: movl %eax, (%rdx)
27 %0 = load i32, ptr @a, align 4
28 %1 = tail call i32 asm "", "=r,r,~{dirflag},~{fpsr},~{flags}"(i32 %0)
29 %2 = icmp eq i32 %1, 0
30 %shl1 = select i1 %2, i32 2, i32 0
31 %3 = load i32, ptr %x, align 4
32 %or = or i32 %3, %shl1
33 store i32 0, ptr %y, align 4
34 %4 = tail call i32 asm "", "=r,~{dirflag},~{fpsr},~{flags}"()
35 %notmask = shl nsw i32 -1, %4
36 %sub = xor i32 %notmask, -1
37 %5 = load i32, ptr @f, align 4
38 %and4 = and i32 %5, %sub
39 %or6 = or i32 %and4, %or
40 store i32 %or6, ptr %z, align 4