Vector Class Discussion

 
thread patch against 1.17 for clang - Dan Huff - 2015-08-07
last reply patch against 1.17 for clang - Agner - 2015-08-08
 
patch against 1.17 for clang
Author:  Date: 2015-08-07 15:44
Compiling vectorclass 2015-07-31 version 1.17 on Mac OS X 10.9.5 with this test program:

#include "vectorclass.h"
int main() { Vec8s s; return 0; }

both with Apple's clang
$ clang --version
Apple LLVM version 6.0 (clang-600.0.57) (based on LLVM 3.5svn)
Target: x86_64-apple-darwin13.4.0
Thread model: posix

and a recent clang from macports:
$ /opt/local/bin/clang-mp-3.6 --version
clang version 3.6.1 (tags/RELEASE_361/final)
Target: x86_64-apple-darwin13.4.0
Thread model: posix

I see this error:

In file included from special/complexvec.h:29:
In file included from vectorclass.h:41:
vectori128.h:5846:64: error: calling a private constructor of class 'Vec8sb'
if (uint16_t(d0) == 0x8000u) return (x == Vec8s(0x8000)) & 1; // prevent overflow when ...
^
vectori128.h:1254:5: note: declared private here
Vec8sb(int b);
^
1 error generated.

I was able to work around this issue with the following diff:

$ diff vectori128.h.orig vectori128.h
5846c5846
< if (uint16_t(d0) == 0x8000u) return (x == Vec8s(0x8000)) & 1; // prevent overflow when changing sign
---
> if (uint16_t(d0) == 0x8000u) return (x == Vec8s(0x8000)) & Vec8s(1); // prevent overflow when changing sign

   
patch against 1.17 for clang
Author: Agner Date: 2015-08-08 01:33
Thank you for the bug report.

It should be:

    if (uint16_t(d0) == 0x8000u) return Vec8s(x == Vec8s(0x8000)) & 1;// prevent overflow when changing sign