|
8 | 8 | define i32 @bit_ceil_i32(i32 %x) { |
9 | 9 | ; NOBMI-LABEL: bit_ceil_i32: |
10 | 10 | ; NOBMI: # %bb.0: |
11 | | -; NOBMI-NEXT: movl %edi, %eax |
12 | | -; NOBMI-NEXT: decl %eax |
13 | | -; NOBMI-NEXT: je .LBB0_1 |
14 | | -; NOBMI-NEXT: # %bb.2: # %cond.false |
15 | | -; NOBMI-NEXT: bsrl %eax, %ecx |
| 11 | +; NOBMI-NEXT: # kill: def $edi killed $edi def $rdi |
| 12 | +; NOBMI-NEXT: leal -1(%rdi), %eax |
| 13 | +; NOBMI-NEXT: bsrl %eax, %eax |
| 14 | +; NOBMI-NEXT: movl $63, %ecx |
| 15 | +; NOBMI-NEXT: cmovnel %eax, %ecx |
16 | 16 | ; NOBMI-NEXT: xorl $31, %ecx |
17 | | -; NOBMI-NEXT: jmp .LBB0_3 |
18 | | -; NOBMI-NEXT: .LBB0_1: |
19 | | -; NOBMI-NEXT: movl $32, %ecx |
20 | | -; NOBMI-NEXT: .LBB0_3: # %cond.end |
21 | 17 | ; NOBMI-NEXT: negb %cl |
22 | 18 | ; NOBMI-NEXT: movl $1, %edx |
23 | 19 | ; NOBMI-NEXT: movl $1, %eax |
@@ -51,15 +47,10 @@ define i32 @bit_ceil_i32(i32 %x) { |
51 | 47 | define i32 @bit_ceil_i32_plus1(i32 noundef %x) { |
52 | 48 | ; NOBMI-LABEL: bit_ceil_i32_plus1: |
53 | 49 | ; NOBMI: # %bb.0: # %entry |
54 | | -; NOBMI-NEXT: testl %edi, %edi |
55 | | -; NOBMI-NEXT: je .LBB1_1 |
56 | | -; NOBMI-NEXT: # %bb.2: # %cond.false |
57 | | -; NOBMI-NEXT: bsrl %edi, %ecx |
| 50 | +; NOBMI-NEXT: bsrl %edi, %eax |
| 51 | +; NOBMI-NEXT: movl $63, %ecx |
| 52 | +; NOBMI-NEXT: cmovnel %eax, %ecx |
58 | 53 | ; NOBMI-NEXT: xorl $31, %ecx |
59 | | -; NOBMI-NEXT: jmp .LBB1_3 |
60 | | -; NOBMI-NEXT: .LBB1_1: |
61 | | -; NOBMI-NEXT: movl $32, %ecx |
62 | | -; NOBMI-NEXT: .LBB1_3: # %cond.end |
63 | 54 | ; NOBMI-NEXT: negb %cl |
64 | 55 | ; NOBMI-NEXT: movl $1, %edx |
65 | 56 | ; NOBMI-NEXT: movl $1, %eax |
@@ -94,16 +85,11 @@ entry: |
94 | 85 | define i64 @bit_ceil_i64(i64 %x) { |
95 | 86 | ; NOBMI-LABEL: bit_ceil_i64: |
96 | 87 | ; NOBMI: # %bb.0: |
97 | | -; NOBMI-NEXT: movq %rdi, %rax |
98 | | -; NOBMI-NEXT: decq %rax |
99 | | -; NOBMI-NEXT: je .LBB2_1 |
100 | | -; NOBMI-NEXT: # %bb.2: # %cond.false |
101 | | -; NOBMI-NEXT: bsrq %rax, %rcx |
102 | | -; NOBMI-NEXT: xorq $63, %rcx |
103 | | -; NOBMI-NEXT: jmp .LBB2_3 |
104 | | -; NOBMI-NEXT: .LBB2_1: |
105 | | -; NOBMI-NEXT: movl $64, %ecx |
106 | | -; NOBMI-NEXT: .LBB2_3: # %cond.end |
| 88 | +; NOBMI-NEXT: leaq -1(%rdi), %rax |
| 89 | +; NOBMI-NEXT: bsrq %rax, %rax |
| 90 | +; NOBMI-NEXT: movl $127, %ecx |
| 91 | +; NOBMI-NEXT: cmovneq %rax, %rcx |
| 92 | +; NOBMI-NEXT: xorl $63, %ecx |
107 | 93 | ; NOBMI-NEXT: negb %cl |
108 | 94 | ; NOBMI-NEXT: movl $1, %edx |
109 | 95 | ; NOBMI-NEXT: movl $1, %eax |
@@ -136,15 +122,10 @@ define i64 @bit_ceil_i64(i64 %x) { |
136 | 122 | define i64 @bit_ceil_i64_plus1(i64 noundef %x) { |
137 | 123 | ; NOBMI-LABEL: bit_ceil_i64_plus1: |
138 | 124 | ; NOBMI: # %bb.0: # %entry |
139 | | -; NOBMI-NEXT: testq %rdi, %rdi |
140 | | -; NOBMI-NEXT: je .LBB3_1 |
141 | | -; NOBMI-NEXT: # %bb.2: # %cond.false |
142 | | -; NOBMI-NEXT: bsrq %rdi, %rcx |
143 | | -; NOBMI-NEXT: xorq $63, %rcx |
144 | | -; NOBMI-NEXT: jmp .LBB3_3 |
145 | | -; NOBMI-NEXT: .LBB3_1: |
146 | | -; NOBMI-NEXT: movl $64, %ecx |
147 | | -; NOBMI-NEXT: .LBB3_3: # %cond.end |
| 125 | +; NOBMI-NEXT: bsrq %rdi, %rax |
| 126 | +; NOBMI-NEXT: movl $127, %ecx |
| 127 | +; NOBMI-NEXT: cmovneq %rax, %rcx |
| 128 | +; NOBMI-NEXT: xorl $63, %ecx |
148 | 129 | ; NOBMI-NEXT: negb %cl |
149 | 130 | ; NOBMI-NEXT: movl $1, %edx |
150 | 131 | ; NOBMI-NEXT: movl $1, %eax |
|
0 commit comments