<html>
<head>
<base href="https://bugs.llvm.org/">
</head>
<body><table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Bug ID</th>
<td><a class="bz_bug_link
bz_status_NEW "
title="NEW - [AVX512] Incorrect register argument to test instruction"
href="https://bugs.llvm.org/show_bug.cgi?id=37396">37396</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>[AVX512] Incorrect register argument to test instruction
</td>
</tr>
<tr>
<th>Product</th>
<td>libraries
</td>
</tr>
<tr>
<th>Version</th>
<td>trunk
</td>
</tr>
<tr>
<th>Hardware</th>
<td>PC
</td>
</tr>
<tr>
<th>OS</th>
<td>All
</td>
</tr>
<tr>
<th>Status</th>
<td>NEW
</td>
</tr>
<tr>
<th>Severity</th>
<td>enhancement
</td>
</tr>
<tr>
<th>Priority</th>
<td>P
</td>
</tr>
<tr>
<th>Component</th>
<td>Backend: X86
</td>
</tr>
<tr>
<th>Assignee</th>
<td>unassignedbugs@nondot.org
</td>
</tr>
<tr>
<th>Reporter</th>
<td>keno@alumni.harvard.edu
</td>
</tr>
<tr>
<th>CC</th>
<td>craig.topper@gmail.com, llvm-bugs@lists.llvm.org
</td>
</tr></table>
<p>
<div>
<pre>Consider the following bugpoint-reduced reproducer of
<a href="https://github.com/JuliaLang/julia/issues/27032">https://github.com/JuliaLang/julia/issues/27032</a>:
```
define void @japi1_foo2_34617() {
pass2: ; preds = %top
br label %if5
L174: ; preds = %if5
%tmp = icmp sgt <2 x i64> undef, zeroinitializer
%tmp1 = icmp sle <2 x i64> undef, undef
%tmp2 = and <2 x i1> %tmp, %tmp1
%tmp3 = extractelement <2 x i1> %tmp2, i32 0
%tmp4 = extractelement <2 x i1> %tmp2, i32 1
%tmp106 = and i1 %tmp4, %tmp3
%tmp107 = zext i1 %tmp106 to i8
%tmp108 = and i8 %tmp122, %tmp107
%tmp109 = icmp eq i8 %tmp108, 0
br i1 %tmp109, label %L188, label %L190
if5: ; preds = %if5, %pass2
%b.055 = phi i8 [ 1, %pass2 ], [ %tmp122, %if5 ]
%tmp118 = icmp sgt i64 undef, 0
%tmp119 = icmp sle i64 undef, undef
%tmp120 = and i1 %tmp118, %tmp119
%tmp121 = zext i1 %tmp120 to i8
%tmp122 = and i8 %b.055, %tmp121
br i1 undef, label %L174, label %if5
L188: ; preds = %L174
unreachable
L190: ; preds = %L174
ret void
}
```
Running llc on trunk (and 6.0) gives:
```
$ llc -mcpu=skylake-avx512 bug.ll -o -
.text
.file "wip.ll"
.globl japi1_foo2_34617 # -- Begin function japi1_foo2_34617
.p2align 4, 0x90
.type japi1_foo2_34617,@function
japi1_foo2_34617: # @japi1_foo2_34617
.cfi_startproc
# %bb.0: # %L174
testq %rax, %rax
setg %al
vpxor %xmm0, %xmm0, %xmm0
vpcmpgtq %xmm0, %xmm0, %k0
kshiftrw $1, %k0, %k1
kandd %k0, %k1, %k0
testb %k0, %al
je .LBB0_1
# %bb.2: # %L190
retq
.LBB0_1: # %L188
.Lfunc_end0:
.size japi1_foo2_34617, .Lfunc_end0-japi1_foo2_34617
.cfi_endproc
# -- End function
.section ".note.GNU-stack","",@progbits
```
llvm-mc says it best:
```
$ llvm-mc bug.s
bug.s:15:8: error: invalid operand for instruction
testb %k0, %al
^~~
```
If we try to generate code directly rather than go through textual assembly,
we end up generating `testb %al, %al`, which was the cause of the above linked
bug report.</pre>
</div>
</p>
<hr>
<span>You are receiving this mail because:</span>
<ul>
<li>You are on the CC list for the bug.</li>
</ul>
</body>
</html>