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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
|
; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
; RUN: llc < %s -mtriple=x86_64-unknown-unknown -mattr=+cmov | FileCheck %s --check-prefix=CMOV
; RUN: llc < %s -mtriple=i686-unknown-unknown -mattr=-cmov | FileCheck %s --check-prefix=NO_CMOV
define i32 @cmov_zpromotion_16_to_32(i1 %c) {
; CMOV-LABEL: cmov_zpromotion_16_to_32:
; CMOV: # BB#0:
; CMOV-NEXT: testb $1, %dil
; CMOV-NEXT: movw $12414, %ax # imm = 0x307E
; CMOV-NEXT: movw $-1, %cx
; CMOV-NEXT: cmovnew %ax, %cx
; CMOV-NEXT: movzwl %cx, %eax
; CMOV-NEXT: retq
;
; NO_CMOV-LABEL: cmov_zpromotion_16_to_32:
; NO_CMOV: # BB#0:
; NO_CMOV-NEXT: testb $1, {{[0-9]+}}(%esp)
; NO_CMOV-NEXT: movw $12414, %ax # imm = 0x307E
; NO_CMOV-NEXT: jne .LBB0_2
; NO_CMOV-NEXT: # BB#1:
; NO_CMOV-NEXT: movw $-1, %ax
; NO_CMOV-NEXT: .LBB0_2:
; NO_CMOV-NEXT: movzwl %ax, %eax
; NO_CMOV-NEXT: retl
%t0 = select i1 %c, i16 12414, i16 -1
%ret = zext i16 %t0 to i32
ret i32 %ret
}
define i64 @cmov_zpromotion_16_to_64(i1 %c) {
; CMOV-LABEL: cmov_zpromotion_16_to_64:
; CMOV: # BB#0:
; CMOV-NEXT: testb $1, %dil
; CMOV-NEXT: movw $12414, %ax # imm = 0x307E
; CMOV-NEXT: movw $-1, %cx
; CMOV-NEXT: cmovnew %ax, %cx
; CMOV-NEXT: movzwl %cx, %eax
; CMOV-NEXT: retq
;
; NO_CMOV-LABEL: cmov_zpromotion_16_to_64:
; NO_CMOV: # BB#0:
; NO_CMOV-NEXT: testb $1, {{[0-9]+}}(%esp)
; NO_CMOV-NEXT: movw $12414, %ax # imm = 0x307E
; NO_CMOV-NEXT: jne .LBB1_2
; NO_CMOV-NEXT: # BB#1:
; NO_CMOV-NEXT: movw $-1, %ax
; NO_CMOV-NEXT: .LBB1_2:
; NO_CMOV-NEXT: movzwl %ax, %eax
; NO_CMOV-NEXT: xorl %edx, %edx
; NO_CMOV-NEXT: retl
%t0 = select i1 %c, i16 12414, i16 -1
%ret = zext i16 %t0 to i64
ret i64 %ret
}
define i32 @cmov_spromotion_16_to_32(i1 %c) {
; CMOV-LABEL: cmov_spromotion_16_to_32:
; CMOV: # BB#0:
; CMOV-NEXT: testb $1, %dil
; CMOV-NEXT: movw $12414, %ax # imm = 0x307E
; CMOV-NEXT: movw $-1, %cx
; CMOV-NEXT: cmovnew %ax, %cx
; CMOV-NEXT: movswl %cx, %eax
; CMOV-NEXT: retq
;
; NO_CMOV-LABEL: cmov_spromotion_16_to_32:
; NO_CMOV: # BB#0:
; NO_CMOV-NEXT: testb $1, {{[0-9]+}}(%esp)
; NO_CMOV-NEXT: movw $12414, %ax # imm = 0x307E
; NO_CMOV-NEXT: jne .LBB2_2
; NO_CMOV-NEXT: # BB#1:
; NO_CMOV-NEXT: movw $-1, %ax
; NO_CMOV-NEXT: .LBB2_2:
; NO_CMOV-NEXT: cwtl
; NO_CMOV-NEXT: retl
%t0 = select i1 %c, i16 12414, i16 -1
%ret = sext i16 %t0 to i32
ret i32 %ret
}
define i64 @cmov_spromotion_16_to_64(i1 %c) {
; CMOV-LABEL: cmov_spromotion_16_to_64:
; CMOV: # BB#0:
; CMOV-NEXT: testb $1, %dil
; CMOV-NEXT: movw $12414, %ax # imm = 0x307E
; CMOV-NEXT: movw $-1, %cx
; CMOV-NEXT: cmovnew %ax, %cx
; CMOV-NEXT: movswq %cx, %rax
; CMOV-NEXT: retq
;
; NO_CMOV-LABEL: cmov_spromotion_16_to_64:
; NO_CMOV: # BB#0:
; NO_CMOV-NEXT: testb $1, {{[0-9]+}}(%esp)
; NO_CMOV-NEXT: movw $12414, %ax # imm = 0x307E
; NO_CMOV-NEXT: jne .LBB3_2
; NO_CMOV-NEXT: # BB#1:
; NO_CMOV-NEXT: movw $-1, %ax
; NO_CMOV-NEXT: .LBB3_2:
; NO_CMOV-NEXT: cwtl
; NO_CMOV-NEXT: movl %eax, %edx
; NO_CMOV-NEXT: sarl $31, %edx
; NO_CMOV-NEXT: retl
%t0 = select i1 %c, i16 12414, i16 -1
%ret = sext i16 %t0 to i64
ret i64 %ret
}
|