| ... | @@ -3758,7 +3758,7 @@ pub fn body(isel: *Select, air_body: []const Air.Inst.Index) error{ OutOfMemory, | ... | @@ -3758,7 +3758,7 @@ pub fn body(isel: *Select, air_body: []const Air.Inst.Index) error{ OutOfMemory, |
| 3758 | } else if (dst_tag == .float and src_tag == .float) { | 3758 | } else if (dst_tag == .float and src_tag == .float) { |
| 3759 | assert(dst_ty.floatBits(isel.target) == src_ty.floatBits(isel.target)); | 3759 | assert(dst_ty.floatBits(isel.target) == src_ty.floatBits(isel.target)); |
| 3760 | try dst_vi.value.defMove(isel, ty_op.operand); | 3760 | try dst_vi.value.defMove(isel, ty_op.operand); |
| 3761 | } else if (dst_ty.isAbiInt(zcu) and src_tag == .float and isel.canUseFprForFloat(src_ty)) { | 3761 | } else if (dst_ty.isAbiInt(zcu) and src_tag == .float and isel.canUseFprForFloat(src_ty.floatBits(isel.target))) { |
| 3762 | const dst_int_info = dst_ty.intInfo(zcu); | 3762 | const dst_int_info = dst_ty.intInfo(zcu); |
| 3763 | assert(dst_int_info.bits == src_ty.floatBits(isel.target)); | 3763 | assert(dst_int_info.bits == src_ty.floatBits(isel.target)); |
| 3764 | | 3764 | |
| ... | @@ -3773,7 +3773,7 @@ pub fn body(isel: *Select, air_body: []const Air.Inst.Index) error{ OutOfMemory, | ... | @@ -3773,7 +3773,7 @@ pub fn body(isel: *Select, air_body: []const Air.Inst.Index) error{ OutOfMemory, |
| 3773 | 64 => .@"movfr2gr.d"(dst_reg, src_reg), | 3773 | 64 => .@"movfr2gr.d"(dst_reg, src_reg), |
| 3774 | }); | 3774 | }); |
| 3775 | try src_mat.finish(isel); | 3775 | try src_mat.finish(isel); |
| 3776 | } else if (dst_tag == .float and src_ty.isAbiInt(zcu) and isel.canUseFprForFloat(dst_ty)) { | 3776 | } else if (dst_tag == .float and src_ty.isAbiInt(zcu) and isel.canUseFprForFloat(dst_ty.floatBits(isel.target))) { |
| 3777 | const src_int_info = src_ty.intInfo(zcu); | 3777 | const src_int_info = src_ty.intInfo(zcu); |
| 3778 | assert(dst_ty.floatBits(isel.target) == src_int_info.bits); | 3778 | assert(dst_ty.floatBits(isel.target) == src_int_info.bits); |
| 3779 | | 3779 | |
| ... | @@ -6942,6 +6942,7 @@ pub const CallAbiIterator = struct { | ... | @@ -6942,6 +6942,7 @@ pub const CallAbiIterator = struct { |
| 6942 | }, | 6942 | }, |
| 6943 | .simple_type => |simple_type| switch (simple_type) { | 6943 | .simple_type => |simple_type| switch (simple_type) { |
| 6944 | .f80 => continue :type_key .{ .int_type = .{ .signedness = .unsigned, .bits = 80 } }, | 6944 | .f80 => continue :type_key .{ .int_type = .{ .signedness = .unsigned, .bits = 80 } }, |
| | 6945 | .f128 => continue :type_key .{ .int_type = .{ .signedness = .unsigned, .bits = 128 } }, |
| 6945 | .usize, | 6946 | .usize, |
| 6946 | .isize, | 6947 | .isize, |
| 6947 | .c_char, | 6948 | .c_char, |
| ... | @@ -6959,7 +6960,22 @@ pub const CallAbiIterator = struct { | ... | @@ -6959,7 +6960,22 @@ pub const CallAbiIterator = struct { |
| 6959 | .signedness = .unsigned, | 6960 | .signedness = .unsigned, |
| 6960 | .bits = zcu.errorSetBits(), | 6961 | .bits = zcu.errorSetBits(), |
| 6961 | } }, | 6962 | } }, |
| 6962 | .f16, .f32, .f64, .f128, .c_longdouble => return isel.fail("CallAbiIterator.resolve({t})", .{simple_type}), | 6963 | .f16, .f32, .f64 => { |
| | 6964 | const bits = ty.floatBits(isel.target); |
| | 6965 | if (isel.canUseFprForFloat(bits)) { |
| | 6966 | if (it.allocReg(.fpr)) |reg| { |
| | 6967 | wip_vi.setHintRegister(isel, reg); |
| | 6968 | if (bits != 16) { |
| | 6969 | wip_vi.setHintModifier(isel, .fromFloatBits(bits)); |
| | 6970 | } else { |
| | 6971 | wip_vi.setHintModifier(isel, .floating32); |
| | 6972 | } |
| | 6973 | } else it.assignStack(wip_vi); |
| | 6974 | } else { |
| | 6975 | continue :type_key .{ .int_type = .{ .signedness = .unsigned, .bits = bits } }; |
| | 6976 | } |
| | 6977 | }, |
| | 6978 | .c_longdouble => return isel.fail("CallAbiIterator.resolve({t})", .{simple_type}), |
| 6963 | else => return isel.fail("CallAbiIterator.resolve({t})", .{simple_type}), | 6979 | else => return isel.fail("CallAbiIterator.resolve({t})", .{simple_type}), |
| 6964 | }, | 6980 | }, |
| 6965 | .struct_type => { | 6981 | .struct_type => { |
| ... | @@ -7280,8 +7296,8 @@ fn vectorBits(isel: *Select) u7 { | ... | @@ -7280,8 +7296,8 @@ fn vectorBits(isel: *Select) u7 { |
| 7280 | } | 7296 | } |
| 7281 | } | 7297 | } |
| 7282 | | 7298 | |
| 7283 | fn canUseFprForFloat(isel: *Select, ty: ZigType) bool { | 7299 | fn canUseFprForFloat(isel: *Select, bits: u16) bool { |
| 7284 | return ty.floatBits(isel.target) <= isel.fprBits(); | 7300 | return bits <= isel.fprBits(); |
| 7285 | } | 7301 | } |
| 7286 | | 7302 | |
| 7287 | fn typeOfField(isel: *Select, ty: ZigType, offset: u64) ?ZigType { | 7303 | fn typeOfField(isel: *Select, ty: ZigType, offset: u64) ?ZigType { |