[cfe-dev] C/C++ operator meaning is different between gcc generic vector type and altivec type
Anton Yartsev via cfe-dev
cfe-dev at lists.llvm.org
Mon Oct 22 08:10:38 PDT 2018
Hi Zixuan,
There is an error in the issue number, the real issue number is 7553
(https://bugs.llvm.org/show_bug.cgi?id=7553).
> I find the related code developed by Anton Yartsev as following git
> commit. FYI, I reported a bug related to this issue before,
> https://bugs.llvm.org/show_bug.cgi?id=31161
> commit 6bd14099c18d34a7dc894ab25654d0b253a3d527
> Author: Anton Yartsev <anton.yartsev at gmail.com>
> Date: Thu Nov 18 03:19:30 2010 +0000
> comparison of AltiVec vectors now gives bool result (fix for 7533)
> Hi, Anton, it sees that we should return vector type instead of bool
> result for vector comparison.
> Could you please have a look at this mail thread? And I also see that
> this commit is fix for 7533. But I can not find the issue, could you
> please give some info about the `7533` issue?
> Thank you very much.
>
>
> Regards,
>
> Zixuan Wu (Zeson)
>
> XL C/C++ Compiler Developer
> IBM Systems, z System
> E-mail: wuzish at cn.ibm.com
> Tel: 86-21-60928420
> /Compiler : The Art of Lowering/
>
> ----- Original message -----
> From: Bill Schmidt/Rochester/IBM
> To: Hubert Tong/Toronto/IBM at IBMCA
> Cc: Jinsong Ji/Jacksonville/IBM at IBMUS, Zi Xuan CW
> Wu/China/IBM at IBMCN, cfe-dev at lists.llvm.org, Nemanja
> Ivanovic/Toronto/IBM at IBMCA
> Subject: Re: C/C++ operator meaning is different between gcc
> generic vector type and altivec type
> Date: Fri, Oct 19, 2018 5:09 AM
>
> Hi Hubert,
>
> Yeah, that is some very badly written text. We'll have to try to
> rewrite that for clarity.
>
> Thanks!
>
> -- Bill
>
> Bill Schmidt, Ph.D.
> STSM, Toolchain Architect for Linux on POWER
> IBM Linux Technology Center
> wschmidt at us.ibm.com (507) 319-6873
>
>
> Inactive hide details for Hubert Tong---10/18/2018 03:51:42
> PM---Sorry, yes. I got confused over the very loose term of "do
> allHubert Tong---10/18/2018 03:51:42 PM---Sorry, yes. I got
> confused over the very loose term of "do all" and the intrinsic of
> vec_all_le bein
>
> From: Hubert Tong/Toronto/IBM
> To: Jinsong Ji/Jacksonville/IBM at IBMUS
> Cc: Zi Xuan CW Wu/China/IBM at IBMCN, cfe-dev at lists.llvm.org, Nemanja
> Ivanovic/Toronto/IBM at IBMCA, Bill Schmidt/Rochester/IBM at IBMUS
> Date: 10/18/2018 03:51 PM
> Subject: Re: C/C++ operator meaning is different between gcc
> generic vector type and altivec type
> ------------------------------------------------------------------------
>
>
> Sorry, yes. I got confused over the very loose term of "do all"
> and the intrinsic of vec_all_le being named with "all".
> The ABI does clearly say:
> The result of binary operators is the same type as the type of the
> input operands.
>
> -- HT
>
>
> Inactive hide details for Jinsong Ji---18-10-2018 03:53:36
> p.m.---Hi Hubert: Looks like the interpretation of ABI should be
> theJinsong Ji---18-10-2018 03:53:36 p.m.---Hi Hubert: Looks like
> the interpretation of ABI should be the opposite of your
> understanding.
>
> From: Jinsong Ji/Jacksonville/IBM
> To: Hubert Tong/Toronto/IBM at IBMCA
> Cc: Zi Xuan CW Wu/China/IBM at IBMCN, cfe-dev at lists.llvm.org, Nemanja
> Ivanovic/Toronto/IBM at IBMCA, Bill Schmidt/Rochester/IBM at IBMUS
> Date: 18-10-2018 03:53 p.m.
> Subject: Re: C/C++ operator meaning is different between gcc
> generic vector type and altivec type
> ------------------------------------------------------------------------
>
>
> Hi Hubert:
>
> Looks like the interpretation of ABI should be the opposite of
> your understanding.
>
> "The ABI (as cited by Hubert) clearly means that all of the
> operators described there* are to operate independently on each
> lane*. Vector binary addition is not "sum across", so why should
> vector <= mean vec_all_le (or vec_any_le, for that matter)? *The
> result of <= should be a vector of booleans.*"
>
>
>
> Best,
>
> Jinsong Ji (纪金松), PhD.
>
> XL C/C++, XL Fortran Compiler Development
> E-mail: jji at us.ibm.com
>
>
> Inactive hide details for Hubert Tong---10/18/2018 10:03:40
> AM---The OpenPOWER ABI for Linux Supplement for the Power
> ArchitectHubert Tong---10/18/2018 10:03:40 AM---The OpenPOWER ABI
> for Linux Supplement for the Power Architecture 64-bit ELF V2 ABI
> documents the fo
>
> From: Hubert Tong/Toronto/IBM
> To: Zi Xuan CW Wu/China/IBM at IBMCN
> Cc: cfe-dev at lists.llvm.org, Jinsong Ji/Jacksonville/IBM at IBMUS,
> Nemanja Ivanovic/Toronto/IBM at IBMCA
> Date: 10/18/2018 10:03 AM
> Subject: Re: C/C++ operator meaning is different between gcc
> generic vector type and altivec type
> ------------------------------------------------------------------------
>
>
> The OpenPOWER ABI for Linux Supplement for the Power Architecture
> 64-bit ELF V2 ABI documents the following under Section 6.2.
> "Vector Operators":
>
> The traditional C/C++ operators are defined on vector types with
> “do all” semantics for unary and binary +, unary and binary –,
> binary *, binary %, and binary / as well as the unary and binary
> shift, logical and comparison operators, and the ternary ?: operator.
>
> So the answer is the the two kinds of vectors have separate
> semantics and Clang is right.
>
> -- HT
>
>
> Inactive hide details for Zi Xuan CW Wu---18-10-2018 02:18:23
> a.m.---Hi, all. I find the meaning of C/C++ language operator '<Zi
> Xuan CW Wu---18-10-2018 02:18:23 a.m.---Hi, all. I find the
> meaning of C/C++ language operator '<=' is different between
> different vector k
>
> From: Zi Xuan CW Wu/China/IBM
> To: cfe-dev at lists.llvm.org
> Cc: Jinsong Ji/Jacksonville/IBM at IBMUS, Nemanja
> Ivanovic/Toronto/IBM at IBMCA, Hubert Tong/Toronto/IBM at IBMCA
> Date: 18-10-2018 02:18 a.m.
> Subject: C/C++ operator meaning is different between gcc generic
> vector type and altivec type
> ------------------------------------------------------------------------
>
>
>
> Hi, all.
>
> I find the meaning of C/C++ language operator '<=' is different
> between different vector kind type. For example, a legal clang
> code as following. But it's ill-formed in GCC.
>
> * typedef int v4 __attribute((vector_size(16)));
>
> int main(){
> v4 va;
> v4 vb;
> vector int a;
> vector int b;
>
> *_int_*_ c = a_*_<=_*_b;_
> *_v4_*_ vc = va_*_<=_*_vb;_
>
> }
>
> g++ a.C
> a.C: In function 'int main()':
> a.C:9:14: error: cannot convert '__vector(4) int' to 'int' in
> initialization
> int c = a<=b;
>
>
> The return type of '<=' operator of Altivec kind vector is not
> same as generic gcc kind vector. One is int, the other one is
> vector. But in GCC, it's same return type and meaning, which is
> described at
> _https://gcc.gnu.org/onlinedocs/gcc/Vector-Extensions.html_
>
> So my question is what it is we would like relational and equality
> operators to do with vectors? We make the meaning of two kind
> vectors consistent or separate? Or which document is standard rule
> to implement the semantic meaning?
>
> *
>
>
> Regards,
>
>
> Zixuan Wu (Zeson)
>
> XL C/C++ Compiler Developer
> IBM Systems, z System
> E-mail: wuzish at cn.ibm.com
> Tel: 86-21-60928420
>
> /Compiler : The Art of Lowering/
>
>
>
>
--
Anton
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20181022/0278c4a7/attachment.html>
More information about the cfe-dev
mailing list