diff --git a/compiler-rt/lib/builtins/ashldi3.c b/compiler-rt/lib/builtins/ashldi3.c index 04f22228f11d..7b835da865d7 100644 --- a/compiler-rt/lib/builtins/ashldi3.c +++ b/compiler-rt/lib/builtins/ashldi3.c @@ -28,7 +28,8 @@ COMPILER_RT_ABI di_int __ashldi3(di_int a, int b) { if (b == 0) return a; result.s.low = input.s.low << b; - result.s.high = (input.s.high << b) | (input.s.low >> (bits_in_word - b)); + result.s.high = + ((su_int)input.s.high << b) | (input.s.low >> (bits_in_word - b)); } return result.all; } diff --git a/compiler-rt/lib/builtins/ashlti3.c b/compiler-rt/lib/builtins/ashlti3.c index 99a133ffa22f..2bebf10401d3 100644 --- a/compiler-rt/lib/builtins/ashlti3.c +++ b/compiler-rt/lib/builtins/ashlti3.c @@ -30,7 +30,8 @@ COMPILER_RT_ABI ti_int __ashlti3(ti_int a, int b) { if (b == 0) return a; result.s.low = input.s.low << b; - result.s.high = (input.s.high << b) | (input.s.low >> (bits_in_dword - b)); + result.s.high = + ((du_int)input.s.high << b) | (input.s.low >> (bits_in_dword - b)); } return result.all; } diff --git a/compiler-rt/lib/builtins/ashrdi3.c b/compiler-rt/lib/builtins/ashrdi3.c index 934a5c47fd69..c0879b8b252d 100644 --- a/compiler-rt/lib/builtins/ashrdi3.c +++ b/compiler-rt/lib/builtins/ashrdi3.c @@ -29,7 +29,8 @@ COMPILER_RT_ABI di_int __ashrdi3(di_int a, int b) { if (b == 0) return a; result.s.high = input.s.high >> b; - result.s.low = (input.s.high << (bits_in_word - b)) | (input.s.low >> b); + result.s.low = + ((su_int)input.s.high << (bits_in_word - b)) | (input.s.low >> b); } return result.all; } diff --git a/compiler-rt/lib/builtins/ashrti3.c b/compiler-rt/lib/builtins/ashrti3.c index b306051df028..d6b1ad9192bf 100644 --- a/compiler-rt/lib/builtins/ashrti3.c +++ b/compiler-rt/lib/builtins/ashrti3.c @@ -31,7 +31,8 @@ COMPILER_RT_ABI ti_int __ashrti3(ti_int a, int b) { if (b == 0) return a; result.s.high = input.s.high >> b; - result.s.low = (input.s.high << (bits_in_dword - b)) | (input.s.low >> b); + result.s.low = + ((du_int)input.s.high << (bits_in_dword - b)) | (input.s.low >> b); } return result.all; }