Sorry, you must verify to complete this action. Please click the verification link in your email. You may re-send via your
profile
.
since icx is based on LLVM technology and clang doesn't treat __m128 as a struct or union.
So code needs to be changed as t8.cpp
C:\temp>icl t9.cpp
Intel(R) C++ Intel(R) 64 Compiler Classic for applications running on Intel(R) 64, Version 2021.1 Beta Build 20200827
t9.cpp
Microsoft (R) Incremental Linker Version 14.28.29333.0
-out:t9.exe
t9.obj
C:\temp>t9.exe
C:\temp>icx t9.cpp
Intel(R) oneAPI DPC+/C+ Compiler Pro for applications running on Intel(R) 64, Version 2021.1 Beta Build 20200827
t9.cpp(11,8): error: member reference base type '__m128' (vector of 4 'float' values) is not a structure or union
V.m128_f32[i] = i + 1.5;
^~~~~~~~
t9.cpp(12,12): error: member reference base type '__m128' (vector of 4 'float' values) is not a structure or union
a = V.m128_f32[i];
^~~~~~~~
2 errors generated.
$ clang++ t9.cpp
t9.cpp:11:3: error: member reference base type '__m128' (vector of 4 'float' values) is not a structure or union
V.m128_f32[i] = i + 1.5;
~^~~~~~~~~
t9.cpp:12:7: error: member reference base type '__m128' (vector of 4 'float' values) is not a structure or union
a = V.m128_f32[i];
~^~~~~~~~~
2 errors generated.
C:\temp>icx t8.cpp
Intel(R) oneAPI DPC+/C+ Compiler Pro for applications running on Intel(R) 64, Version 2021.1 Beta Build 20200827
C:\temp>t8.exe
C:\temp> notepad t9.cpp
#include <immintrin.h>
#include <iostream>
using namespace std;
int main () {
float a;
__m128 V;
for (int i =0; i< 4; i ++)
V.m128_f32[i] = i + 1.5;
a = V.m128_f32[i];
cout << a << endl;
return 1 ;
C:\temp> notepad t8.cpp
#include <iostream>
#include <immintrin.h>
#include <vector>
using namespace std;
int main () {
__m128 a;
float b;
for (int i =0; i< 4; i ++)
a[i] = i +1.5;
b = a[i];
cout << b << endl;
return 0;
typedef __int8 Int8;
typedef __int16 Int16;
typedef __int32 Int32;
typedef __int64 Int64;
typedef unsigned __int8 UInt8;
typedef unsigned __int16 UInt16;
typedef unsigned __int32 UInt32;
typedef unsigned __int64 UInt64;
typedef char* String;
typedef float Single;
typedef double Double;
typedef bool Boolean;
struct Matrix3D
union
struct
Single M11, M12, M13, M14;
Single M21, M22, M23, M24;
Single M31, M32, M33, M34;
Single M44, M43, M42, M41;
__m128 Row[4];
float Arr[4][4];
__m256 _Row[4];
friend Matrix3D operator*(Matrix3D left, Matrix3D right)
Matrix3D Res = { 0 };
__m128 Dst;
for (Int32 i = 0; i < 4; i++)
for (Int32 j = 0; j < 4; j++)
Dst = _mm_mul_ps(left.Row[i], right.Row[j]);
Dst = _mm_hadd_ps(Dst, Dst);
Dst = _mm_hadd_ps(Dst, Dst);
Res.Arr[i][j] += Dst.m128_f32[0];
//result.Arr[i][j] += left.Arr[i][0] * right.Arr[0][j];
//result.Arr[i][j] += left.Arr[i][1] * right.Arr[1][j];
//result.Arr[i][j] += left.Arr[i][2] * right.Arr[2][j];
//result.Arr[i][j] += left.Arr[i][3] * right.Arr[3][j];
Res._Row[0] = _mm256_broadcast_ps(&Res.Row[0]);
Res._Row[1] = _mm256_broadcast_ps(&Res.Row[1]);
Res._Row[2] = _mm256_broadcast_ps(&Res.Row[2]);
Res._Row[3] = _mm256_broadcast_ps(&Res.Row[3]);
return (Res);
since icx is based on LLVM technology and clang doesn't treat __m128 as a struct or union.
So code needs to be changed as t8.cpp
C:\temp>icl t9.cpp
Intel(R) C++ Intel(R) 64 Compiler Classic for applications running on Intel(R) 64, Version 2021.1 Beta Build 20200827
t9.cpp
Microsoft (R) Incremental Linker Version 14.28.29333.0
-out:t9.exe
t9.obj
C:\temp>t9.exe
C:\temp>icx t9.cpp
Intel(R) oneAPI DPC+/C+ Compiler Pro for applications running on Intel(R) 64, Version 2021.1 Beta Build 20200827
t9.cpp(11,8): error: member reference base type '__m128' (vector of 4 'float' values) is not a structure or union
V.m128_f32[i] = i + 1.5;
^~~~~~~~
t9.cpp(12,12): error: member reference base type '__m128' (vector of 4 'float' values) is not a structure or union
a = V.m128_f32[i];
^~~~~~~~
2 errors generated.
$ clang++ t9.cpp
t9.cpp:11:3: error: member reference base type '__m128' (vector of 4 'float' values) is not a structure or union
V.m128_f32[i] = i + 1.5;
~^~~~~~~~~
t9.cpp:12:7: error: member reference base type '__m128' (vector of 4 'float' values) is not a structure or union
a = V.m128_f32[i];
~^~~~~~~~~
2 errors generated.
C:\temp>icx t8.cpp
Intel(R) oneAPI DPC+/C+ Compiler Pro for applications running on Intel(R) 64, Version 2021.1 Beta Build 20200827
C:\temp>t8.exe
C:\temp> notepad t9.cpp
#include <immintrin.h>
#include <iostream>
using namespace std;
int main () {
float a;
__m128 V;
for (int i =0; i< 4; i ++)
V.m128_f32[i] = i + 1.5;
a = V.m128_f32[i];
cout << a << endl;
return 1 ;
C:\temp> notepad t8.cpp
#include <iostream>
#include <immintrin.h>
#include <vector>
using namespace std;
int main () {
__m128 a;
float b;
for (int i =0; i< 4; i ++)
a[i] = i +1.5;
b = a[i];
cout << b << endl;
return 0;
Community support is provided during standard business hours (Monday to Friday 7AM - 5PM PST). Other contact methods are available
here
.
Intel does not verify all solutions, including but not limited to any file transfers that may appear in this community. Accordingly, Intel disclaims all express and implied warranties, including without limitation, the implied warranties of merchantability, fitness for a particular purpose, and non-infringement, as well as any warranty arising from course of performance, course of dealing, or usage in trade.
For more complete information about compiler optimizations, see our
Optimization Notice
.