Skip to content

Commit

Permalink
[AARCH64] Fix HAS_VST1 check if compiled by clang (#49182)
Browse files Browse the repository at this point in the history
Summary:
Use `UL` suffix supported by all C99 compatible compilers  instead of `__AARCH64_UINT64_C`, which is a gcc specific extension

Before the change this check would have failed as follows with a bug-free clang compiler with the following errors:
```
$ clang has_vst1.c
has_vst1.c:5:41: warning: implicit declaration of function '__AARCH64_UINT64_C' is invalid in C99 [-Wimplicit-function-declaration]
  v.val[0] = vcombine_f32 (vcreate_f32 (__AARCH64_UINT64_C (0)), vcreate_f32 (__AARCH64_UINT64_C (0)));
                                        ^
has_vst1.c:5:79: warning: implicit declaration of function '__AARCH64_UINT64_C' is invalid in C99 [-Wimplicit-function-declaration]
  v.val[0] = vcombine_f32 (vcreate_f32 (__AARCH64_UINT64_C (0)), vcreate_f32 (__AARCH64_UINT64_C (0)));
                                                                              ^
has_vst1.c:6:41: warning: implicit declaration of function '__AARCH64_UINT64_C' is invalid in C99 [-Wimplicit-function-declaration]
  v.val[1] = vcombine_f32 (vcreate_f32 (__AARCH64_UINT64_C (0)), vcreate_f32 (__AARCH64_UINT64_C (0)));
                                        ^
has_vst1.c:6:79: warning: implicit declaration of function '__AARCH64_UINT64_C' is invalid in C99 [-Wimplicit-function-declaration]
  v.val[1] = vcombine_f32 (vcreate_f32 (__AARCH64_UINT64_C (0)), vcreate_f32 (__AARCH64_UINT64_C (0)));
                                                                              ^
4 warnings generated.
/tmp/has_vst1-b1e162.o: In function `main':
has_vst1.c:(.text+0x30): undefined reference to `__AARCH64_UINT64_C'
```

Fixes #{issue number}

Pull Request resolved: #49182

Reviewed By: walterddr

Differential Revision: D25471994

Pulled By: malfet

fbshipit-source-id: 0129a6f7aabc46aa117ef719d3a211449cb410f1
  • Loading branch information
malfet authored and facebook-github-bot committed Dec 10, 2020
1 parent f4226b5 commit 84fce6d
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -684,8 +684,8 @@ if(CMAKE_SYSTEM_PROCESSOR MATCHES "aarch64")
int main() {
float a[] = {1.0, 1.0};
float32x4x2_t v;
v.val[0] = vcombine_f32 (vcreate_f32 (__AARCH64_UINT64_C (0)), vcreate_f32 (__AARCH64_UINT64_C (0)));
v.val[1] = vcombine_f32 (vcreate_f32 (__AARCH64_UINT64_C (0)), vcreate_f32 (__AARCH64_UINT64_C (0)));
v.val[0] = vcombine_f32 (vcreate_f32 (0UL), vcreate_f32 (0UL));
v.val[1] = vcombine_f32 (vcreate_f32 (0UL), vcreate_f32 (0UL));
vst1q_f32_x2(a, v);
return 0;
}" HAS_VST1)
Expand Down

0 comments on commit 84fce6d

Please sign in to comment.