1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
| ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
;RUN: llc < %s -O2 -mattr=+avx512f -mtriple=x86_64-unknown | FileCheck %s
@n = common global i32 0, align 4
@m = common global i32 0, align 4
define i32 @main(i8 %small) {
; CHECK-LABEL: main:
; CHECK: # %bb.0: # %entry
; CHECK-NEXT: testb $1, %dil
; CHECK-NEXT: movl $m, %eax
; CHECK-NEXT: movl $n, %ecx
; CHECK-NEXT: cmoveq %rax, %rcx
; CHECK-NEXT: movl (%rcx), %eax
; CHECK-NEXT: retq
entry:
%0 = and i8 %small, 1
%cmp = icmp eq i8 %0, 0
%m.n = select i1 %cmp, i32* @m, i32* @n
%retval = load volatile i32, i32* %m.n, align 4
ret i32 %retval
}
define i32 @main2(i8 %small) {
; CHECK-LABEL: main2:
; CHECK: # %bb.0: # %entry
; CHECK-NEXT: movl $m, %eax
; CHECK-NEXT: movl $n, %ecx
; CHECK-NEXT: testb $1, %dil
; CHECK-NEXT: cmovneq %rax, %rcx
; CHECK-NEXT: movl (%rcx), %eax
; CHECK-NEXT: retq
entry:
%0 = and i8 %small, 1
%cmp = icmp eq i8 %0, 1
%m.n = select i1 %cmp, i32* @m, i32* @n
%retval = load volatile i32, i32* %m.n, align 4
ret i32 %retval
}
|