<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 - __builtin_constant_p does not work on powerpc"
href="https://bugs.llvm.org/show_bug.cgi?id=36730">36730</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>__builtin_constant_p does not work on powerpc
</td>
</tr>
<tr>
<th>Product</th>
<td>libraries
</td>
</tr>
<tr>
<th>Version</th>
<td>6.0
</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>enhancement
</td>
</tr>
<tr>
<th>Priority</th>
<td>P
</td>
</tr>
<tr>
<th>Component</th>
<td>Backend: PowerPC
</td>
</tr>
<tr>
<th>Assignee</th>
<td>unassignedbugs@nondot.org
</td>
</tr>
<tr>
<th>Reporter</th>
<td>nruslan_devel@yahoo.com
</td>
</tr>
<tr>
<th>CC</th>
<td>llvm-bugs@lists.llvm.org
</td>
</tr></table>
<p>
<div>
<pre>Found that at least for 64-bit and 128-bit types, clang/llvm does not seem to
detect that the specified value is a constant (PPC64 target).
(GCC seems to work fine for both types.)
Example:
static inline unsigned char func1(__uint128_t a)
{
if (__builtin_constant_p(a)) {
return 1;
}
return 0;
}
unsigned char test_func1()
{
return func1(0);
}
static inline unsigned char func2(unsigned long long a)
{
if (__builtin_constant_p(a)) {
return 1;
}
return 0;
}
unsigned char test_func2()
{
return func2(0);
}
Generated code:
(clang -Wall -O2 -target powerpc64-linux-gnu -S test.c)
test_func1: # @test_func1
.p2align 3
.quad .Lfunc_begin0
.quad .TOC.@tocbase
.quad 0
.text
.Lfunc_begin0:
# %bb.0:
li 3, 0
blr
...
test_func2: # @test_func2
.p2align 3
.quad .Lfunc_begin1
.quad .TOC.@tocbase
.quad 0
.text
.Lfunc_begin1:
# %bb.0:
li 3, 0
blr</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>