Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
| From | James Kuyper <jameskuyper@verizon.net> |
|---|---|
| Newsgroups | comp.lang.c++, comp.lang.c |
| Subject | Re: Why compiler is able to vectorize on int but not on unsigned |
| Date | 2014-12-03 13:13 -0500 |
| Organization | Self |
| Message-ID | <547F52D5.8020900@verizon.net> (permalink) |
| References | <20141203111909.5ec8c7fc@maxa-pc> <87a934k4b0.fsf@dpt-info.u-strasbg.fr> |
Cross-posted to 2 groups.
On 12/03/2014 12:53 PM, Alain Ketterlin wrote:
> Melzzzzz <mel@zzzzz.com> writes:
>
>> int testNormal(const vector_t & ghs, const vector_t & lhs) {
>> int max = 0;
>> int tempMax;
>> for (unsigned k = 0; k < ghs.size(); k++) {
>> tempMax = lhs[k] + ghs[k];
>> if (max < tempMax) {
>> max = tempMax;
>> }
>> }
>> return max;
>> }
>>
>> where: typedef vector<int> vector_t;
>> (could be also plain array so I post this to clc as well)
>
> A plain array would have been better, because the explanation has
> nothing to do with vectors/templates/whatnot
He's already posted (nearly three hours ago) a message indicating that
the problem does not occur when using plain arrays, so the explanation
must indeed have something to do with vectors/templates/whatnot - to be
more precise, it seems to be connected to the use of ghs.size().
Back to comp.lang.c | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
Why compiler is able to vectorize on int but not on unsigned Melzzzzz <mel@zzzzz.com> - 2014-12-03 11:19 +0100
Re: Why compiler is able to vectorize on int but not on unsigned James Kuyper <jameskuyper@verizon.net> - 2014-12-03 08:02 -0500
Re: Why compiler is able to vectorize on int but not on unsigned jacob navia <jacob@spamsink.net> - 2014-12-03 14:57 +0100
Re: Why compiler is able to vectorize on int but not on unsigned Tim Prince <tprince@computer.org> - 2014-12-03 09:23 -0500
Re: Why compiler is able to vectorize on int but not on unsigned James Kuyper <jameskuyper@verizon.net> - 2014-12-03 10:03 -0500
Re: Why compiler is able to vectorize on int but not on unsigned Victor Bazarov <v.bazarov@comcast.invalid> - 2014-12-03 09:24 -0500
Re: Why compiler is able to vectorize on int but not on unsigned Richard Heathfield <invalid@see.sig.invalid> - 2014-12-03 14:36 +0000
Re: Why compiler is able to vectorize on int but not on unsigned Melzzzzz <mel@zzzzz.com> - 2014-12-03 16:03 +0100
Re: Why compiler is able to vectorize on int but not on unsigned Victor Bazarov <v.bazarov@comcast.invalid> - 2014-12-03 10:27 -0500
Re: Why compiler is able to vectorize on int but not on unsigned Melzzzzz <mel@zzzzz.com> - 2014-12-03 16:43 +0100
Why compiler is able to vectorize on int but not on unsigned "Rick C. Hodgin" <rick.c.hodgin@gmail.com> - 2014-12-03 06:35 -0800
Re: Why compiler is able to vectorize on int but not on unsigned Melzzzzz <mel@zzzzz.com> - 2014-12-03 16:09 +0100
Re: Why compiler is able to vectorize on int but not on unsigned Alain Ketterlin <alain@dpt-info.u-strasbg.fr> - 2014-12-03 18:53 +0100
Re: Why compiler is able to vectorize on int but not on unsigned James Kuyper <jameskuyper@verizon.net> - 2014-12-03 13:13 -0500
Re: Why compiler is able to vectorize on int but not on unsigned Alain Ketterlin <alain@dpt-info.u-strasbg.fr> - 2014-12-04 22:04 +0100
Re: Why compiler is able to vectorize on int but not on unsigned Melzzzzz <mel@zzzzz.com> - 2014-12-05 10:07 +0100
Re: Why compiler is able to vectorize on int but not on unsigned Alain Ketterlin <alain@dpt-info.u-strasbg.fr> - 2014-12-05 10:42 +0100
Re: Why compiler is able to vectorize on int but not on unsigned Melzzzzz <mel@zzzzz.com> - 2014-12-05 11:29 +0100
csiph-web