<html>
<head>
<base href="https://llvm.org/bugs/" />
</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 --- - r235837 broke 8-bit vector multiplies on older x86"
href="https://llvm.org/bugs/show_bug.cgi?id=23369">23369</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>r235837 broke 8-bit vector multiplies on older x86
</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>Linux
</td>
</tr>
<tr>
<th>Status</th>
<td>NEW
</td>
</tr>
<tr>
<th>Severity</th>
<td>normal
</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>andrew.b.adams@gmail.com
</td>
</tr>
<tr>
<th>CC</th>
<td>llvmbugs@cs.uiuc.edu
</td>
</tr>
<tr>
<th>Classification</th>
<td>Unclassified
</td>
</tr></table>
<p>
<div>
<pre>vectorized 8-bit multiplies no longer produce correct results on k8. To repro:
scratch.ll:
define void @test(<16 x i8>* %a, <16 x i8>* %b, <16 x i8>* %c) {
%1 = load <16 x i8>, <16 x i8>* %a
%2 = load <16 x i8>, <16 x i8>* %b
%3 = mul <16 x i8> %1, %2
store <16 x i8> %3, <16 x i8>* %c
ret void
}
test.c:
#include <stdint.h>
#include <stdio.h>
void test(uint8_t *a, uint8_t *b, uint8_t *c);
int main(int argc, char **argv) {
uint8_t a[] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16};
uint8_t b[] = {2, 4, 1, 3, 2, 4, 1, 2, 2, 3, 1, 4, 1, 2, 3, 4};
uint8_t correct[16];
for (int i = 0; i < 16; i++) {
correct[i] = a[i] * b[i];
}
uint8_t actual[16];
test(a, b, actual);
for (int i = 0; i < 16; i++) {
printf("%d %d\n", correct[i], actual[i]);
}
return 0;
}
Compile scratch.ll two different ways:
llc -O3 scratch.ll -mcpu=penryn -filetype=obj -o scratch_penryn.o
llc -O3 scratch.ll -mcpu=k8 -filetype=obj -o scratch_k8.o
Make two binaries:
clang test.c scratch_penryn.o -o test_penryn
clang test.c scratch_k8.o -o test_k8
Run them:
test_penryn:
2 2
8 8
3 3
12 12
10 10
24 24
7 7
16 16
18 18
30 30
11 11
48 48
13 13
28 28
45 45
64 64
The columns match, this is correct.
test_k8:
2 1
8 4
3 9
12 16
10 25
24 36
7 49
16 64
18 18
30 30
11 11
48 48
13 13
28 28
45 45
64 64
The multiply only happened for the second half of the lanes. For the first half
of the lanes it just passes through the input.</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>