[llvm-dev] Problem with Aarch64 ?

Mehdi Amini via llvm-dev llvm-dev at lists.llvm.org
Wed Sep 7 10:43:09 PDT 2016


> On Sep 7, 2016, at 10:32 AM, Somenath Chakraborty via llvm-dev <llvm-dev at lists.llvm.org> wrote:
> 
> Hello,
> 
> I am facing an issue with a small test where there is a chance that sign-extension is not introduced as expected -
> 
> #include <stdio.h>
> 
> void func( long x )
> {
>     printf(" %ld \n", x);
> }
> 
> int main()
> {
>     char c = -1;

I believe the signedness of char is implementation defined, have you tried using `signed char`?

— 
Mehdi


>     func ( c );  // c is zero extended to x
>     return 0;
> }
> 
> generated IR - 
> 
> define i32 @main() #0 {
>  ........
>   store i8 -1, i8* %c, align 1
>   %2 = load i8, i8* %c, align 1
>   %3 = zext i8 %2 to i64
>   call void @func(i64 %3)
> }
> 
> The value to the formal argument is zero-extended, different from x86_64. Is this a known issue ? Am I missing anything ?
> 
> Thanks,
> Somenath
> 
> _______________________________________________
> LLVM Developers mailing list
> llvm-dev at lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20160907/d82750c9/attachment.html>


More information about the llvm-dev mailing list