-
Notifications
You must be signed in to change notification settings - Fork 10.8k
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
[clang] Resolve FIXME in altivec.h #78905
Draft
AtariDreams
wants to merge
1
commit into
llvm:main
Choose a base branch
from
AtariDreams:clang
base: main
Could not load branches
Branch not found: {{ refName }}
Could not load tags
Nothing to show
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.
Draft
Conversation
This file contains 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
llvmbot
added
clang
Clang issues not falling into any other category
backend:X86
clang:headers
Headers provided by Clang, e.g. for intrinsics
labels
Jan 21, 2024
@llvm/pr-subscribers-backend-x86 @llvm/pr-subscribers-clang Author: AtariDreams (AtariDreams) Changestreat parameter as a 5-bit signed literal. Full diff: https://github.com/llvm/llvm-project/pull/78905.diff 1 Files Affected:
diff --git a/clang/lib/Headers/altivec.h b/clang/lib/Headers/altivec.h
index 4971631c50f412..8693ef61571d8c 100644
--- a/clang/lib/Headers/altivec.h
+++ b/clang/lib/Headers/altivec.h
@@ -10311,78 +10311,82 @@ static __inline__ vector float __ATTRS_o_ai vec_vspltw(vector float __a,
b1, b2, b3, __b, b1, b2, b3));
}
+typedef union {
+ struct {
+ signed int value:5; // 5-bit signed integer
+ } field;
+ signed char byte;
+} FiveBitSigned;
+
/* vec_splat_s8 */
#define __builtin_altivec_vspltisb vec_splat_s8
-// FIXME: parameter should be treated as 5-bit signed literal
static __inline__ vector signed char __ATTRS_o_ai
vec_splat_s8(signed char __a) {
- return (vector signed char)(__a);
+ FiveBitSigned fbs;
+ fbs.byte = __a;
+ return (vector signed char)(fbs.field.value);
}
/* vec_vspltisb */
-
-// FIXME: parameter should be treated as 5-bit signed literal
static __inline__ vector signed char __ATTRS_o_ai
vec_vspltisb(signed char __a) {
- return (vector signed char)(__a);
+ FiveBitSigned fbs;
+ fbs.byte = __a;
+ return (vector signed char)(fbs.field.value);
}
/* vec_splat_s16 */
-
-#define __builtin_altivec_vspltish vec_splat_s16
-
-// FIXME: parameter should be treated as 5-bit signed literal
static __inline__ vector short __ATTRS_o_ai vec_splat_s16(signed char __a) {
- return (vector short)(__a);
+ FiveBitSigned fbs;
+ fbs.byte = __a;
+ return (vector short)(fbs.field.value);
}
/* vec_vspltish */
-
-// FIXME: parameter should be treated as 5-bit signed literal
static __inline__ vector short __ATTRS_o_ai vec_vspltish(signed char __a) {
- return (vector short)(__a);
+ FiveBitSigned fbs;
+ fbs.byte = __a;
+ return (vector short)(fbs.field.value);
}
/* vec_splat_s32 */
-
-#define __builtin_altivec_vspltisw vec_splat_s32
-
-// FIXME: parameter should be treated as 5-bit signed literal
static __inline__ vector int __ATTRS_o_ai vec_splat_s32(signed char __a) {
- return (vector int)(__a);
+ FiveBitSigned fbs;
+ fbs.byte = __a;
+ return (vector int)(fbs.field.value);
}
/* vec_vspltisw */
-
-// FIXME: parameter should be treated as 5-bit signed literal
static __inline__ vector int __ATTRS_o_ai vec_vspltisw(signed char __a) {
- return (vector int)(__a);
+ FiveBitSigned fbs;
+ fbs.byte = __a;
+ return (vector int)(fbs.field.value);
}
/* vec_splat_u8 */
-
-// FIXME: parameter should be treated as 5-bit signed literal
static __inline__ vector unsigned char __ATTRS_o_ai
vec_splat_u8(unsigned char __a) {
- return (vector unsigned char)(__a);
+ FiveBitSigned fbs;
+ fbs.byte = __a;
+ return (vector unsigned char)(fbs.field.value);
}
/* vec_splat_u16 */
-
-// FIXME: parameter should be treated as 5-bit signed literal
static __inline__ vector unsigned short __ATTRS_o_ai
vec_splat_u16(signed char __a) {
- return (vector unsigned short)(__a);
+ FiveBitSigned fbs;
+ fbs.byte = __a;
+ return (vector unsigned short)(fbs.field.value);
}
/* vec_splat_u32 */
-
-// FIXME: parameter should be treated as 5-bit signed literal
static __inline__ vector unsigned int __ATTRS_o_ai
vec_splat_u32(signed char __a) {
- return (vector unsigned int)(__a);
+ FiveBitSigned fbs;
+ fbs.byte = __a;
+ return (vector unsigned int)(fbs.field.value);
}
/* vec_sr */
|
treat parameter as a 5-bit signed literal.
I do not thing this is a proper fix and that it actually improves anything. "Treat as signed 5-bit literal" means that:
|
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
backend:PowerPC
backend:X86
clang:headers
Headers provided by Clang, e.g. for intrinsics
clang
Clang issues not falling into any other category
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.
treat parameter as a 5-bit signed literal.