[Bug target/91342] Incorrect parameter type for AVX512 streaming intrinsics.

2019-08-04 Thread a-yee at u dot northwestern.edu
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=91342

--- Comment #2 from Alex Yee  ---
Oh I didn't realize Intel's docs were conflicting. I think most people just use
the interactive intrinsics guide.

MSVC and Intel's own compiler implement the void* variants. Thus, this comes up
when porting code coming from those.

[Bug c++/91345] New: Typedef'ed restrict pointers may break compilation.

2019-08-04 Thread a-yee at u dot northwestern.edu
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=91345

Bug ID: 91345
   Summary: Typedef'ed restrict pointers may break compilation.
   Product: gcc
   Version: 9.1.0
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: c++
  Assignee: unassigned at gcc dot gnu.org
  Reporter: a-yee at u dot northwestern.edu
  Target Milestone: ---

Potentially Related:
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=91344


The following code compiles on Clang, MSVC, and ICC. But it fails on GCC.

https://godbolt.org/z/6pTjDc


#ifdef _WIN32
#define RESTRICT __restrict
#else
#define RESTRICT __restrict__
#endif

template  using r_ptr  = type *RESTRICT;

template 
class Child{
void func(r_ptr ptr);
};

template <> void Child::func(r_ptr ptr){}



GCC fails to compile it:

:8:18: error: template-id 'func<>' for 'void
Child::func(r_ptr)' does not match any template declaration

8 | template <> void Child::func(r_ptr ptr){}

  |  ^~

:8:49: note: saw 1 'template<>', need 2 for specializing a member
function template

8 | template <> void Child::func(r_ptr ptr){}

  | ^

ASM generation compiler returned: 1

:8:18: error: template-id 'func<>' for 'void
Child::func(r_ptr)' does not match any template declaration

8 | template <> void Child::func(r_ptr ptr){}

  |  ^~

:8:49: note: saw 1 'template<>', need 2 for specializing a member
function template

8 | template <> void Child::func(r_ptr ptr){}

  | ^

Execution build compiler returned: 1

[Bug c++/91344] New: Function pointers in templates with restrict semantics may fail to compile.

2019-08-03 Thread a-yee at u dot northwestern.edu
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=91344

Bug ID: 91344
   Summary: Function pointers in templates with restrict semantics
may fail to compile.
   Product: gcc
   Version: 9.1.0
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: c++
  Assignee: unassigned at gcc dot gnu.org
  Reporter: a-yee at u dot northwestern.edu
  Target Milestone: ---

The following code compiles on Clang, MSVC, and ICC. But it fails on GCC.

https://godbolt.org/z/zHq0qi


#include 
using namespace std;

#ifdef _WIN32
#define RESTRICT __restrict
#else
#define RESTRICT __restrict__
#endif


//  Works
//template  using r_ptr = type *;

//  Fails
template  using r_ptr = type *RESTRICT;


template  ptr)>
void foo(){
int x = 123;
fp();
}

void fp(r_ptr ptr){
cout << ptr[0] << endl;
}

int main(int argc, char* argv[]) {

foo();

}



But on GCC, it gives:

: In function 'int main(int, char**)':

:30:13: error: no matching function for call to 'foo()'

   30 | foo();

  | ^

:19:6: note: candidate: 'template)> void foo()'

   19 | void foo(){

  |  ^~~

:19:6: note:   template argument deduction/substitution failed:

:30:13: error: could not convert template argument 'fp' from
'void(r_ptr)' {aka 'void(int*)'} to 'void (*)(int* __restrict__)'

   30 | foo();

  | ^

ASM generation compiler returned: 1

: In function 'int main(int, char**)':

:30:13: error: no matching function for call to 'foo()'

   30 | foo();

  | ^

:19:6: note: candidate: 'template)> void foo()'

   19 | void foo(){

  |  ^~~

:19:6: note:   template argument deduction/substitution failed:

:30:13: error: could not convert template argument 'fp' from
'void(r_ptr)' {aka 'void(int*)'} to 'void (*)(int* __restrict__)'

   30 | foo();

  |

[Bug c++/91343] New: Spurious strict-aliasing warning with template class inheritance.

2019-08-03 Thread a-yee at u dot northwestern.edu
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=91343

Bug ID: 91343
   Summary: Spurious strict-aliasing warning with template class
inheritance.
   Product: gcc
   Version: 9.1.0
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: c++
  Assignee: unassigned at gcc dot gnu.org
  Reporter: a-yee at u dot northwestern.edu
  Target Milestone: ---

The following code leads to a strict-aliasing warning. But there is no aliasing
here.

https://godbolt.org/z/m2P_4-

Possibly Related or Duplicate:
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=89960
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=81152


#include 
using namespace std;

struct Parent{
int data = 0;
};

template 
class Child : public Parent{
public:
static int func(){
Child tp;
int x = tp.data;
return x;
}
};

template class Child;


int main(){

}





: In static member function 'static int Child::func()':

:13:17: warning: dereferencing type-punned pointer will break
strict-aliasing rules [-Wstrict-aliasing]

   13 | int x = tp.data;

  | ^~

ASM generation compiler returned: 0

: In static member function 'static int Child::func()':

:13:17: warning: dereferencing type-punned pointer will break
strict-aliasing rules [-Wstrict-aliasing]

   13 | int x = tp.data;

  | ^~

[Bug target/91342] New: Incorrect parameter type for AVX512 streaming intrinsics.

2019-08-03 Thread a-yee at u dot northwestern.edu
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=91342

Bug ID: 91342
   Summary: Incorrect parameter type for AVX512 streaming
intrinsics.
   Product: gcc
   Version: 9.1.0
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: target
  Assignee: unassigned at gcc dot gnu.org
  Reporter: a-yee at u dot northwestern.edu
  Target Milestone: ---

According to Intel's docs, all 4 of the AVX512 streaming instructions take void
pointers.

void _mm512_stream_ps (void* mem_addr, __m512 a)
void _mm512_stream_pd (void* mem_addr, __m512d a)
void _mm512_stream_si512 (void* mem_addr, __m512i a)
__m512i _mm512_stream_load_si512 (void const* mem_addr)


But GCC's implementation takes typed pointers.

https://godbolt.org/z/Dkte12

[Bug target/91341] New: Missing AVX Intrinsics: load/store u2

2019-08-03 Thread a-yee at u dot northwestern.edu
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=91341

Bug ID: 91341
   Summary: Missing AVX Intrinsics: load/store u2
   Product: gcc
   Version: 9.1.0
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: target
  Assignee: unassigned at gcc dot gnu.org
  Reporter: a-yee at u dot northwestern.edu
  Target Milestone: ---

The following intrinsics are missing:
 - _mm256_loadu2_m128()
 - _mm256_storeu2_m128()
 - _mm256_loadu2_m128d()
 - _mm256_storeu2_m128d()
 - _mm256_loadu2_m128i()
 - _mm256_storeu2_m128i()

https://godbolt.org/z/1jj_-e

[Bug target/91340] New: Missing AVX and AVX512 Intrinsics: Zero-Extension

2019-08-03 Thread a-yee at u dot northwestern.edu
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=91340

Bug ID: 91340
   Summary: Missing AVX and AVX512 Intrinsics: Zero-Extension
   Product: gcc
   Version: 9.1.0
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: target
  Assignee: unassigned at gcc dot gnu.org
  Reporter: a-yee at u dot northwestern.edu
  Target Milestone: ---

All the zero-extension intrinsics are missing: https://godbolt.org/z/JV8I51

#include 

int main()
{
//  128 -> 256
_mm256_zextps128_ps256(_mm_setzero_ps());
_mm256_zextpd128_pd256(_mm_setzero_pd());
_mm256_zextsi128_si256(_mm_setzero_si128());

//  128 -> 256
_mm512_zextps128_ps512(_mm_setzero_ps());
_mm512_zextpd128_pd512(_mm_setzero_pd());
_mm512_zextsi128_si512(_mm_setzero_si128());

//  256 -> 512
_mm512_zextps256_ps512(_mm256_setzero_ps());
_mm512_zextpd256_pd512(_mm256_setzero_pd());
_mm512_zextsi256_si512(_mm256_setzero_si256());

}