Collectives™ on Stack Overflow
Find centralized, trusted content and collaborate around the technologies you use most.
Learn more about Collectives
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
Learn more about Teams
I'm trying to write some SIMD code (in C++Builder 10.1 Berlin), but I'm getting an
E2257
error in
mmintrin.h
(which is included by
xmmintrin.h
, which should be included for SIMD stuff). There's a bunch of identical errors, so it seems that bcc32 can't handle the syntax found in those headers.
For instance, all the lines containing
__atribute__
seems to cause this error:
typedef long long __m64 __attribute__((__vector_size__(8)));
To me, this does seem like a C++builder bug, but I'm not sure, and to be honest I'm not familiar with __atribute__
(this doesn't seem to be a C++ keyword, so I assume it's either a function/macro or a language extension).
UPDATE: Since C++ Builder 10.1 Berlin can use Clang (bcc32c
as opposed to the old compiler bcc32
) , I tried that as well and that helped remove all the E2257
errors. Unfortunately, I'm now getting an ICE ( [bcc32c Error] FillObj.cpp(1): ICE: Internal compiler error: C0000005 @ 27287E3D ). The culprit is this line _mm_storeu_ps(&a[i], xmm0 );
Commenting out this line makes the code compile. This code is just an example but it's enough to recreate the problem.
#include <xmmintrin.h>
void SumValues(float * a, float * b, unsigned len){
__m128 xmm0, xmm1;
//for this simple example , it's assumed len is divisible by
for(int i=0; i<len; i += 4){
xmm0 = _mm_loadu_ps( &a[i] );
xmm1 = _mm_loadu_ps( &b[i] );
xmm0 = _mm_add_ps(xmm0, xmm1);
_mm_storeu_ps( &a[i], xmm0 );//this line is causing the ICE described above
As I said in a comment , this works fine in Qt (using MinGw 5.5.0 ). About the Clang compiler, I'm not exactly sure which version it is, but since it has to support all the VCL stuff, I don't think it's a standard clang compiler.
–
–
–
–
I used the 10.4 Sydney 64-bit Windows C++ compiler in the IDE and your example compiles and executes for me.
void SumValues(float * a, float * b, unsigned len){
__m128 xmm0, xmm1;
//for this simple example , it's assumed len is divisible by
for(int i=0; i<len; i += 4){
xmm0 = _mm_loadu_ps( &a[i] );
xmm1 = _mm_loadu_ps( &b[i] );
xmm0 = _mm_add_ps(xmm0, xmm1);
_mm_storeu_ps( &a[i], xmm0 );//this line is causing the ICE described above
__fastcall TForm1::TForm1(TComponent* Owner)
: TForm(Owner)
//---------------------------------------------------------------------------
void __fastcall TForm1::Button1Click(TObject *Sender)
float myA[4],myB[4];
myA[0] = 0.0;
myA[1] = 1.0;
myA[2] = 2.0;
myA[3] = 3.0;
myB[0] = 0.0;
myB[1] = 1.0;
myB[2] = 2.0;
myB[3] = 3.0;
SumValues(myA,myB,4);
Button1->Caption = FloatToStr(myA[2]);
–
–
–
–
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.