-
Notifications
You must be signed in to change notification settings - Fork 16
arc: fix for extvsi split patterns #270
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
Open
Alexehv77
wants to merge
1
commit into
trunk
Choose a base branch
from
fix_extvsi
base: trunk
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,67 @@ | ||
| /* { dg-do run } */ | ||
| /* { dg-options "-O2 -mcpu=em -save-temps" } */ | ||
|
|
||
| #include <stdio.h> | ||
| #include <stdlib.h> | ||
|
|
||
| /* Test multi-bit Extraction Pattern (*extvsi_n_0). */ | ||
| struct bitstruct { | ||
| unsigned a : 21; | ||
| unsigned b : 8; | ||
| unsigned c : 2; | ||
| int d : 17; | ||
| } __attribute__((packed)); | ||
|
|
||
| static volatile struct bitstruct bits = { | ||
| .a = 0x100, | ||
| .b = 0x2f, | ||
| .c = 0, | ||
| .d = 0 | ||
| }; | ||
|
|
||
| volatile int global_d; | ||
|
|
||
| /* Test snigle-bit Extraction Pattern (*extvsi_1_0). */ | ||
| struct source_struct { | ||
| int target_bit : 1; | ||
| unsigned int padding : 31; | ||
| } __attribute__((packed)); | ||
|
|
||
| static volatile struct source_struct data = { | ||
| .target_bit = 1, | ||
| .padding = 0xabcdef | ||
| }; | ||
|
|
||
| volatile int destination; | ||
|
|
||
| int | ||
| main (void) | ||
| { | ||
| /* 1. Execute Multi-bit Sign-Extract Test */ | ||
| global_d = bits.d; | ||
| if (global_d != 0) | ||
| { | ||
| printf ("FAIL: Multi-bit extract (*extvsi_n_0) failed. Expected 0, got %d\n", global_d); | ||
| abort (); | ||
| } | ||
|
|
||
| /* 2. Execute Single-bit Sign-Extract Test */ | ||
| destination = data.target_bit; | ||
| if (destination != -1) | ||
| { | ||
| printf ("FAIL: Single-bit extract (*extvsi_1_0) failed. Expected -1, got %d\n", destination); | ||
| abort (); | ||
| } | ||
|
|
||
| printf ("PASS: Both sign-extract patterns executed successfully.\n"); | ||
| return 0; | ||
| } | ||
|
|
||
| /* Check that the extvsi_n_0 split got triggered. */ | ||
| /* { dg-final { scan-assembler "bmsk.*,16" } } */ | ||
| /* { dg-final { scan-assembler "bxor.*,16" } } */ | ||
| /* { dg-final { scan-assembler "sub.*,65536" } } */ | ||
|
|
||
| /* Check that the extvsi_1_0 split got triggered. */ | ||
| /* { dg-final { scan-assembler "bmsk.*,0" } } */ | ||
| /* { dg-final { scan-assembler "neg" } } */ |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I was under the impression that this was a functional issue.
But the resulting RTL pattern is correct?
This is just for performance?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The first define_insn_and_split has potential to generate incorrect code.
For the second one there was a change from && 1 to &&reload_completed and at the same time there was a change from (sign_extract:SI (match_operand:SI 1 "register_operand" "0")
to (sign_extract:SI (match_operand:SI 1 "register_operand" "r").
My point is that there is no need to have the both as the second change (i.e, (sign_extract:SI (match_operand:SI 1 "register_operand" "0") to (sign_extract:SI (match_operand:SI 1 "register_operand" "r")) is enough allowing the split to take place even before ra.