Skip to content

PowerPC half precision float shenanigans #45121

@nemanjai

Description

@nemanjai
Bugzilla Link 45776
Resolution FIXED
Resolved on Jun 22, 2020 15:47
Version trunk
OS All
Blocks #44654
CC @nemanjai,@tstellar
Fixed by commit(s) 1a493b0 1abba52

Extended Description

I recently fixed #39212 but in doing so, missed a bunch of other cases that cause crashes in the PPC back end. Tests borrowed from the X86 back end.

All of the following crash the PPC back end with -mcpu=pwr9:
define i64 @​test_fptosi_i64(half* %p) #​0 {
%a = load half, half* %p, align 2
%r = fptosi half %a to i64
ret i64 %r
}
define void @​test_sitofp_i64(i64 %a, half* %p) #​0 {
%r = sitofp i64 %a to half
store half %r, half* %p
ret void
}
define i64 @​test_fptoui_i64(half* %p) #​0 {
%a = load half, half* %p, align 2
%r = fptoui half %a to i64
ret i64 %r
}
define void @​test_uitofp_i64(i64 %a, half* %p) #​0 {
%r = uitofp i64 %a to half
store half %r, half* %p
ret void
}
define <4 x float> @​test_extend32_vec4(<4 x half>* %p) #​0 {
%a = load <4 x half>, <4 x half>* %p, align 8
%b = fpext <4 x half> %a to <4 x float>
ret <4 x float> %b
}
define <4 x double> @​test_extend64_vec4(<4 x half>* %p) #​0 {
%a = load <4 x half>, <4 x half>* %p, align 8
%b = fpext <4 x half> %a to <4 x double>
ret <4 x double> %b
}
define void @​test_trunc32_vec4(<4 x float> %a, <4 x half>* %p) #​0 {
%v = fptrunc <4 x float> %a to <4 x half>
store <4 x half> %v, <4 x half>* %p
ret void
}
define void @​test_trunc64_vec4(<4 x double> %a, <4 x half>* %p) #​0 {
%v = fptrunc <4 x double> %a to <4 x half>
store <4 x half> %v, <4 x half>* %p
ret void
}

And the last two crash the back end with -mcpu=pwr8.

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions