Thanks to visit codestin.com
Credit goes to github.com

Skip to content
Merged
Changes from 2 commits
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
9f4f90b
Merge commit 'e4fe941b11a55c5005630696e9b6d81c65f7bd04' into subtree-…
antoyo Oct 26, 2023
ff57d70
Merge commit '09ce29d0591a21e1abae22eac4d41ffd32993af8' into subtree-…
antoyo Oct 27, 2023
249969c
Disable `master` feature by default when building rustc_codegen_gcc
GuillaumeGomez Oct 28, 2023
34e6386
Fix compilation errors in rustc_codegen_gcc examples
GuillaumeGomez Oct 28, 2023
a37446b
Fix config.sh script
GuillaumeGomez Oct 28, 2023
1075b80
Pass `--sysroot` option
GuillaumeGomez Oct 28, 2023
a13408d
Remove `libc` dependency in cg_gcc alloc_system example
GuillaumeGomez Oct 30, 2023
9149bec
Fix vector compilation error
antoyo Oct 25, 2023
f20f6bb
Merge pull request #368 from rust-lang/fix/vector-error
antoyo Nov 3, 2023
cc2af1f
Do not emit .eh_frame section when using -Cpanic=abort
antoyo Oct 25, 2023
551ea4b
Merge pull request #374 from rust-lang/fix/eh-frame
antoyo Nov 8, 2023
4dbfa4d
Set the .comment section
antoyo Oct 27, 2023
c6bc7ec
Merge pull request #377 from rust-lang/feature/comment-section
antoyo Nov 8, 2023
b2add8a
target_feature: make it more clear what that 'Option' means
RalfJung Nov 12, 2023
a6493c1
Bump cfg(bootstrap)s
Mark-Simulacrum Nov 13, 2023
0e8e60c
Merge branch 'master' into sync_from_rust_2023_11_17
antoyo Nov 17, 2023
4d8b25c
Update patch disabling portable-simd
antoyo Nov 17, 2023
a3b6444
Fix CI
antoyo Nov 18, 2023
2e8386e
Merge pull request #387 from rust-lang/sync_from_rust_2023_11_17
antoyo Nov 19, 2023
fa696af
Merge commit '2e8386e9fb3506cef991d04f8b3bc78f9a0c2630' into subtree-…
antoyo Nov 19, 2023
326f241
Pass TyCtxt by value
antoyo Nov 19, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 22 additions & 3 deletions src/int.rs
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,9 @@ impl<'a, 'gcc, 'tcx> Builder<'a, 'gcc, 'tcx> {
a >> b
}
}
else if a_type.is_vector() && a_type.is_vector() {
a >> b
}
else if a_native && !b_native {
self.gcc_lshr(a, self.gcc_int_cast(b, a_type))
}
Expand Down Expand Up @@ -144,7 +147,7 @@ impl<'a, 'gcc, 'tcx> Builder<'a, 'gcc, 'tcx> {
fn additive_operation(&self, operation: BinaryOp, a: RValue<'gcc>, mut b: RValue<'gcc>) -> RValue<'gcc> {
let a_type = a.get_type();
let b_type = b.get_type();
if self.is_native_int_type_or_bool(a_type) && self.is_native_int_type_or_bool(b_type) {
if (self.is_native_int_type_or_bool(a_type) && self.is_native_int_type_or_bool(b_type)) || (a_type.is_vector() && b_type.is_vector()) {
if a_type != b_type {
if a_type.is_vector() {
// Vector types need to be bitcast.
Expand All @@ -158,6 +161,8 @@ impl<'a, 'gcc, 'tcx> Builder<'a, 'gcc, 'tcx> {
self.context.new_binary_op(None, operation, a_type, a, b)
}
else {
debug_assert!(a_type.dyncast_array().is_some());
debug_assert!(b_type.dyncast_array().is_some());
let signed = a_type.is_compatible_with(self.i128_type);
let func_name =
match (operation, signed) {
Expand Down Expand Up @@ -189,10 +194,12 @@ impl<'a, 'gcc, 'tcx> Builder<'a, 'gcc, 'tcx> {
fn multiplicative_operation(&self, operation: BinaryOp, operation_name: &str, signed: bool, a: RValue<'gcc>, b: RValue<'gcc>) -> RValue<'gcc> {
let a_type = a.get_type();
let b_type = b.get_type();
if self.is_native_int_type_or_bool(a_type) && self.is_native_int_type_or_bool(b_type) {
if (self.is_native_int_type_or_bool(a_type) && self.is_native_int_type_or_bool(b_type)) || (a_type.is_vector() && b_type.is_vector()) {
self.context.new_binary_op(None, operation, a_type, a, b)
}
else {
debug_assert!(a_type.dyncast_array().is_some());
debug_assert!(b_type.dyncast_array().is_some());
let sign =
if signed {
""
Expand Down Expand Up @@ -337,6 +344,8 @@ impl<'a, 'gcc, 'tcx> Builder<'a, 'gcc, 'tcx> {
pub fn operation_with_overflow(&self, func_name: &str, lhs: RValue<'gcc>, rhs: RValue<'gcc>) -> (RValue<'gcc>, RValue<'gcc>) {
let a_type = lhs.get_type();
let b_type = rhs.get_type();
debug_assert!(a_type.dyncast_array().is_some());
debug_assert!(b_type.dyncast_array().is_some());
let param_a = self.context.new_parameter(None, a_type, "a");
let param_b = self.context.new_parameter(None, b_type, "b");
let result_field = self.context.new_field(None, a_type, "result");
Expand Down Expand Up @@ -496,7 +505,11 @@ impl<'a, 'gcc, 'tcx> Builder<'a, 'gcc, 'tcx> {
pub fn gcc_xor(&self, a: RValue<'gcc>, b: RValue<'gcc>) -> RValue<'gcc> {
let a_type = a.get_type();
let b_type = b.get_type();
if self.is_native_int_type_or_bool(a_type) && self.is_native_int_type_or_bool(b_type) {
if a_type.is_vector() && b_type.is_vector() {
let b = self.bitcast_if_needed(b, a_type);
a ^ b
}
else if self.is_native_int_type_or_bool(a_type) && self.is_native_int_type_or_bool(b_type) {
a ^ b
}
else {
Expand Down Expand Up @@ -527,6 +540,9 @@ impl<'a, 'gcc, 'tcx> Builder<'a, 'gcc, 'tcx> {
a << b
}
}
else if a_type.is_vector() && a_type.is_vector() {
a << b
}
else if a_native && !b_native {
self.gcc_shl(a, self.gcc_int_cast(b, a_type))
}
Expand Down Expand Up @@ -690,6 +706,7 @@ impl<'gcc, 'tcx> CodegenCx<'gcc, 'tcx> {
let a_native = self.is_native_int_type_or_bool(a_type);
let b_native = self.is_native_int_type_or_bool(b_type);
if a_type.is_vector() && b_type.is_vector() {
let b = self.bitcast_if_needed(b, a_type);
self.context.new_binary_op(None, operation, a_type, a, b)
}
else if a_native && b_native {
Expand Down Expand Up @@ -748,6 +765,7 @@ impl<'gcc, 'tcx> CodegenCx<'gcc, 'tcx> {
return self.context.new_cast(None, value, dest_typ);
}

debug_assert!(value_type.dyncast_array().is_some());
let name_suffix =
match self.type_kind(dest_typ) {
TypeKind::Float => "tisf",
Expand Down Expand Up @@ -781,6 +799,7 @@ impl<'gcc, 'tcx> CodegenCx<'gcc, 'tcx> {
return self.context.new_cast(None, value, dest_typ);
}

debug_assert!(value_type.dyncast_array().is_some());
let name_suffix =
match self.type_kind(value_type) {
TypeKind::Float => "sfti",
Expand Down