On Oct 24, 2012, at 12:38 PM, Jakub Jelinek <ja...@redhat.com> wrote: > On Wed, Oct 24, 2012 at 08:36:19PM +0200, Marc Glisse wrote: >> On Wed, 24 Oct 2012, Jason Merrill wrote: >> >>> On 10/19/2012 04:40 PM, Marc Glisse wrote: >>>> So between the following: >>>> a) x?y:z means (x<0)?y:z >>>> b) x?y:z means (x!=0)?y:z >>>> c) x?y:z is rejected, only things like (x==t)?y:z are accepted >>>> d) other >>>> >>>> is the choice still b) ? That's an easy one, only 2 characters to change >>>> in the patch (assuming the rest is correct) :-) >>> >>> That would be my inclination, but I'm not a vector programming expert, >> >> I'm not an expert at all either, and I find the OpenCL semantics >> quite confusing, where truth is implicitly x<0 for x?y:z but x!=0 >> for x&&y or !x, so in particular (x&&y)?z:t is not equivalent to >> x?y?z:t:t, and I am quite happy with your suggestion to deviate. I >> was surprised because I hadn't considered the possibility, but now I >> actually like it better than OpenCL ;-) >> >>> so I guess let's go with the OpenCL semantics. >> >> Ok. I take it as: let's wait a few days in case people want to >> comment, then you'll review the original patch? > > I'd prefer b) as well, but I'm not a vector programming expert either.
Well, I suspect the OpenCL community had a ton of people sweat over the details and take into consideration the realities and the needs of people. I'd like to believe they had more people in on this and that this was a compromise for someones vector unit. I like b myself, however, following OpenCL I think might be better. Tough choice. The problem is, what if your vector unit produces 0, 1, to be compatible with C? Suddenly, spilling this onto ? is annoying, both because it doesn't match hardware, nor the expected semantics of a person that just knows C. Maybe we run a poll of vector units that prefer -1 or prefer 1 for true, and then decide. SSE has CMPPS, which likes the -1. Altivec's vec_cmpgt says true is all bits 1. Gosh, I guess we can stop there. Neon, for fun VCGE is defined to set to all ones for true. OpenCL it is.