setOperationAction(ISD::FMA, MVT::v2f16, Legal);
setOperationAction(ISD::FMINNUM, MVT::v2f16, Legal);
setOperationAction(ISD::FMAXNUM, MVT::v2f16, Legal);
+ setOperationAction(ISD::FCANONICALIZE, MVT::v2f16, Legal);
// This isn't really legal, but this avoids the legalizer unrolling it (and
// allows matching fneg (fabs x) patterns)
declare half @llvm.canonicalize.f16(half) #0
declare <2 x half> @llvm.canonicalize.v2f16(<2 x half>) #0
declare i32 @llvm.amdgcn.workitem.id.x() #0
+declare <2 x double> @llvm.canonicalize.v2f64(<2 x double>) #0
; GCN-LABEL: {{^}}v_test_canonicalize_var_f32:
; GCN: v_mul_f32_e32 [[REG:v[0-9]+]], 1.0, {{v[0-9]+}}
ret void
}
+; GCN-LABEL: {{^}}v_test_canonicalize_var_v2f64:
+; GCN: v_max_f64
+; GCN: v_max_f64
+define amdgpu_kernel void @v_test_canonicalize_var_v2f64(<2 x double> addrspace(1)* %out) #1 {
+ %tid = call i32 @llvm.amdgcn.workitem.id.x()
+ %gep = getelementptr <2 x double>, <2 x double> addrspace(1)* %out, i32 %tid
+ %val = load <2 x double>, <2 x double> addrspace(1)* %gep
+ %canonicalized = call <2 x double> @llvm.canonicalize.v2f64(<2 x double> %val)
+ store <2 x double> %canonicalized, <2 x double> addrspace(1)* %out
+ ret void
+}
+
attributes #0 = { nounwind readnone }
attributes #1 = { nounwind }
attributes #2 = { nounwind "target-features"="-fp32-denormals,-fp64-fp16-denormals" }