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

Fix the weird-ass crash on AArch64 #4832

Merged
merged 2 commits into from
Mar 28, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
15 changes: 0 additions & 15 deletions ci/drone/linux_script
Original file line number Diff line number Diff line change
Expand Up @@ -15,21 +15,6 @@ pip3 install s3cmd
# This will affect the cmake command below.
git config core.abbrev 9

# This patch is a workaround for
# https://github.com/ziglang/zig/issues/4822
patch <<'END_PATCH'
--- CMakeLists.txt
+++ CMakeLists.txt
@@ -430,7 +430,6 @@ set(BUILD_LIBSTAGE2_ARGS "build-lib"
--cache on
--output-dir "${CMAKE_BINARY_DIR}"
${LIBSTAGE2_RELEASE_ARG}
- --bundle-compiler-rt
-fPIC
-lc
${LIBSTAGE2_WINDOWS_ARGS}
END_PATCH

mkdir build
cd build
cmake .. -DCMAKE_BUILD_TYPE=Release "-DCMAKE_INSTALL_PREFIX=$DISTDIR" -DZIG_STATIC=ON -DCMAKE_PREFIX_PATH=/deps/local
Expand Down
10 changes: 5 additions & 5 deletions lib/std/special/compiler_rt/floatunditf.zig
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ const builtin = @import("builtin");
const is_test = builtin.is_test;
const std = @import("std");

pub fn __floatunditf(a: u128) callconv(.C) f128 {
pub fn __floatunditf(a: u64) callconv(.C) f128 {
@setRuntimeSafety(is_test);

if (a == 0) {
Expand All @@ -14,11 +14,11 @@ pub fn __floatunditf(a: u128) callconv(.C) f128 {
const exponent_bias = (1 << (exponent_bits - 1)) - 1;
const implicit_bit = 1 << mantissa_bits;

const exp = (u128.bit_count - 1) - @clz(u128, a);
const shift = mantissa_bits - @intCast(u7, exp);
const exp: u128 = (u64.bit_count - 1) - @clz(u64, a);
const shift: u7 = mantissa_bits - @intCast(u7, exp);

var result: u128 align(16) = (a << shift) ^ implicit_bit;
result += (@intCast(u128, exp) + exponent_bias) << mantissa_bits;
var result: u128 = (@intCast(u128, a) << shift) ^ implicit_bit;
result += (exp + exponent_bias) << mantissa_bits;

return @bitCast(f128, result);
}
Expand Down
2 changes: 1 addition & 1 deletion lib/std/special/compiler_rt/floatunditf_test.zig
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
const __floatunditf = @import("floatunditf.zig").__floatunditf;

fn test__floatunditf(a: u128, expected_hi: u64, expected_lo: u64) void {
fn test__floatunditf(a: u64, expected_hi: u64, expected_lo: u64) void {
const x = __floatunditf(a);

const x_repr = @bitCast(u128, x);
Expand Down