Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

test: Avoid errors when cross compile by gcc-8.3/9.2 #625

Merged
merged 1 commit into from
Mar 29, 2024

Conversation

howjmay
Copy link
Collaborator

@howjmay howjmay commented Jan 7, 2024

Cross compiling with gcc-8.3 and gcc-9.2 would cause operand mismatch
error in some tests. The C code of some tests were compiled into
stange instructions. Fixing the error by not running the tests
when using gcc-8.3 and gcc-9.2

fixes #622

@howjmay howjmay requested review from jserv and marktwtn as code owners January 7, 2024 03:57
@jserv jserv marked this pull request as draft January 22, 2024 04:06
@jserv
Copy link
Member

jserv commented Jan 22, 2024

CI reported "gcc-arm-8.3-2019.02-x86_64-arm-linux-gnueabihf.tar.xz: Cannot open: No such file or directory". Can you check?

@howjmay howjmay force-pushed the fix-gcc-8-3 branch 8 times, most recently from e7a63fe to e16335b Compare January 27, 2024 07:07
@howjmay
Copy link
Collaborator Author

howjmay commented Jan 27, 2024

@jserv
I am downloading gcc-8.3.0 from https://developer.arm.com/downloads/-/gnu-a
and run the cross tests with it. However it successfully passed the tests. Am I using the wrong source?

@jserv
Copy link
Member

jserv commented Jan 27, 2024

I am downloading gcc-8.3.0 from https://developer.arm.com/downloads/-/arm-gnu-toolchain-downloads
and run the cross tests with it. However it successfully passed the tests. Am I using the wrong source?

I extracted the GNU Toolchain to /tmp/gcc-arm-8.3-2019.03-x86_64-aarch64-linux-gnu/lib/gcc/aarch64-linux-gnu on node1 machine, and it is still reproducible.

jserv@node1:~/sse2neon$ make CROSS_COMPILE=aarch64-linux-gnu- check
./sse2neon.h:110:2: warning: #warning "GCC versions earlier than 10 are not supported." [-Wcpp]
 #warning "GCC versions earlier than 10 are not supported."
  ^~~~~~~
/tmp/ccCwgoD5.s: Assembler messages:
/tmp/ccCwgoD5.s:41889: Error: operand mismatch -- `rev16 v0.4h,v0.4h'
/tmp/ccCwgoD5.s:41889: Info:    did you mean this?
/tmp/ccCwgoD5.s:41889: Info:            rev16 v0.8b, v0.8b
/tmp/ccCwgoD5.s:41889: Info:    other valid variant(s):
/tmp/ccCwgoD5.s:41889: Info:            rev16 v0.16b, v0.16b
...

@jserv
Copy link
Member

jserv commented Feb 29, 2024

I extracted the GNU Toolchain to /tmp/gcc-arm-8.3-2019.03-x86_64-aarch64-linux-gnu/lib/gcc/aarch64-linux-gnu on node1 machine, and it is still reproducible.

Similarly, the following messages were raised by GitHub Actions:

/tmp/ccA3eMRR.s: Assembler messages:
/tmp/ccA3eMRR.s:41889: Error: operand mismatch -- `rev16 v0.4h,v0.4h'
/tmp/ccA3eMRR.s:41889: Info:    did you mean this?
/tmp/ccA3eMRR.s:41889: Info:    	rev16 v0.8b, v0.8b
/tmp/ccA3eMRR.s:41889: Info:    other valid variant(s):
/tmp/ccA3eMRR.s:41889: Info:    	rev16 v0.16b, v0.16b
/tmp/ccA3eMRR.s:74999: Error: operand mismatch -- `rev32 v0.4s,v0.4s'
/tmp/ccA3eMRR.s:74999: Info:    did you mean this?
/tmp/ccA3eMRR.s:74999: Info:    	rev32 v0.8b, v0.8b
/tmp/ccA3eMRR.s:74999: Info:    other valid variant(s):
/tmp/ccA3eMRR.s:74999: Info:    	rev32 v0.16b, v0.16b
/tmp/ccA3eMRR.s:74999: Info:    	rev32 v0.4h, v0.4h
/tmp/ccA3eMRR.s:74999: Info:    	rev32 v0.8h, v0.8h
/tmp/ccA3eMRR.s:94176: Error: operand mismatch -- `rev16 v0.8h,v0.8h'
/tmp/ccA3eMRR.s:94176: Info:    did you mean this?
/tmp/ccA3eMRR.s:94176: Info:    	rev16 v0.8b, v0.8b
/tmp/ccA3eMRR.s:94176: Info:    other valid variant(s):
/tmp/ccA3eMRR.s:94176: Info:    	rev16 v0.16b, v0.16b
/tmp/ccA3eMRR.s:113227: Error: operand mismatch -- `rev16 v0.8h,v0.8h'
/tmp/ccA3eMRR.s:113227: Info:    did you mean this?
/tmp/ccA3eMRR.s:113227: Info:    	rev16 v0.8b, v0.8b
/tmp/ccA3eMRR.s:113227: Info:    other valid variant(s):
/tmp/ccA3eMRR.s:113227: Info:    	rev16 v0.16b, v0.16b

@howjmay howjmay force-pushed the fix-gcc-8-3 branch 8 times, most recently from 9b55316 to c032914 Compare March 4, 2024 10:54
@howjmay
Copy link
Collaborator Author

howjmay commented Mar 4, 2024

@jserv The problems was caused by the test code. sse2neon.h itself have no error on this bug. I have added the tests in this PR just for you to take a look. Once you think everything is OK I will remove them

@jserv
Copy link
Member

jserv commented Mar 4, 2024

@jserv The problems was caused by the test code. sse2neon.h itself have no error on this bug. I have added the tests in this PR just for you to take a look. Once you think everything is OK I will remove them

It sounds great. Please go ahead for fixing test code.

@howjmay howjmay changed the title fix: Fix failed build on gcc-8.3 test: Avoid errors when cross compile by gcc-8.3/9.2 Mar 4, 2024
@howjmay howjmay force-pushed the fix-gcc-8-3 branch 2 times, most recently from 5651202 to 0aa746d Compare March 4, 2024 14:54
@howjmay howjmay marked this pull request as ready for review March 4, 2024 14:59
tests/impl.cpp Outdated
@@ -2813,26 +2813,31 @@ result_t test_mm_sfence(const SSE2NEONTestImpl &impl, uint32_t iter)

result_t test_mm_shuffle_pi16(const SSE2NEONTestImpl &impl, uint32_t iter)
{
#if (__GNUC__ == 8 && __GNUC_MINOR__ == 3) || \
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wonder if gcc versions other than 8.3 and 9.2 encounter the same problem or not.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there any other version that suggested to check?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there any other version that suggested to check?

We have to clarify if the known issue appears in gcc version prior to 8.3.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have added the supported versions in README. And I found even g++-8.4 would meet the same compiling error, therefore I have made the corresponding change in impl.cpp

@howjmay howjmay force-pushed the fix-gcc-8-3 branch 4 times, most recently from 5b6e7be to 5be1d59 Compare March 21, 2024 08:14
README.md Outdated
@@ -60,6 +60,10 @@ reciprocal square root of `0.0`, then INF * `0.0` using `vmulq_f32`). In contras
the SSE counterpart produces INF if a source value is `0.0`.
As a result, additional treatments should be applied to ensure consistency between the conversion and its SSE counterpart.

## Requirement

We advise developers to utilize sse2neon.h with GCC version 10 or higher, or Clang version 11 or higher. While sse2neon.h might be compatible with earlier versions, certain vector operation errors have been identified in those versions. For further details, refer to the discussion in issue [#622](https://github.com/DLTcollab/sse2neon/issues/622).
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Refine the text with a third-person view.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

tests/impl.cpp Outdated Show resolved Hide resolved
@howjmay howjmay force-pushed the fix-gcc-8-3 branch 2 times, most recently from 92b57d5 to fadc7c4 Compare March 28, 2024 04:01
tests/impl.cpp Outdated
@@ -2813,26 +2813,29 @@ result_t test_mm_sfence(const SSE2NEONTestImpl &impl, uint32_t iter)

result_t test_mm_shuffle_pi16(const SSE2NEONTestImpl &impl, uint32_t iter)
{
#if (__GNUC__ == 8) || (__GNUC__ == 9 && __GNUC_MINOR__ == 2)
#error gcc-8.3, gcc-9.2 would cause operand mismatch error here
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Refine the message:

Using older gcc versions can lead to an operand mismatch error. This issue affects all versions prior to gcc 10.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

@howjmay howjmay force-pushed the fix-gcc-8-3 branch 2 times, most recently from bf4cde5 to c84256a Compare March 29, 2024 15:49
Cross compiling with gcc-8.3 and gcc-9.2 would cause operand mismatch
error in some tests. The C code of some tests were compiled into
stange instructions. Fixing the error by not running the tests
when using gcc-8.3 and gcc-9.2

fixes DLTcollab#622
@jserv jserv merged commit 8df2f48 into DLTcollab:master Mar 29, 2024
16 checks passed
@howjmay howjmay deleted the fix-gcc-8-3 branch March 29, 2024 16:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Error compiling with GCC 8.3.0
2 participants