@@ -312,8 +312,68 @@ define dso_local zeroext i32 @func(double noundef %0, double noundef %1) #0 {
312312 ret i32 %9
313313}
314314
315+ ; To check ppc_fp128 soften without crash
316+ define zeroext i1 @ppcf128_soften (ppc_fp128 %a ) #0 {
317+ ; PPC-LABEL: ppcf128_soften:
318+ ; PPC: # %bb.0: # %entry
319+ ; PPC-NEXT: stwu 1, -16(1)
320+ ; PPC-NEXT: stw 5, 8(1) # 4-byte Folded Spill
321+ ; PPC-NEXT: mr 5, 4
322+ ; PPC-NEXT: lwz 4, 8(1) # 4-byte Folded Reload
323+ ; PPC-NEXT: stw 5, 12(1) # 4-byte Folded Spill
324+ ; PPC-NEXT: mr 5, 3
325+ ; PPC-NEXT: lwz 3, 12(1) # 4-byte Folded Reload
326+ ; PPC-NEXT: # kill: def $r4 killed $r3
327+ ; PPC-NEXT: # kill: def $r4 killed $r5
328+ ; PPC-NEXT: xoris 4, 5, 65520
329+ ; PPC-NEXT: or 4, 3, 4
330+ ; PPC-NEXT: cntlzw 4, 4
331+ ; PPC-NEXT: clrlwi 5, 5, 1
332+ ; PPC-NEXT: or 3, 3, 5
333+ ; PPC-NEXT: cntlzw 3, 3
334+ ; PPC-NEXT: or 3, 3, 4
335+ ; PPC-NEXT: srwi 3, 3, 5
336+ ; PPC-NEXT: addi 1, 1, 16
337+ ; PPC-NEXT: blr
338+ ;
339+ ; PPC64-LABEL: ppcf128_soften:
340+ ; PPC64: # %bb.0: # %entry
341+ ; PPC64-NEXT: li 4, 4095
342+ ; PPC64-NEXT: rldic 4, 4, 52, 0
343+ ; PPC64-NEXT: cmpld 7, 3, 4
344+ ; PPC64-NEXT: mfcr 4 # cr7
345+ ; PPC64-NEXT: rlwinm 4, 4, 31, 31, 31
346+ ; PPC64-NEXT: clrldi 3, 3, 1
347+ ; PPC64-NEXT: cmpldi 7, 3, 0
348+ ; PPC64-NEXT: mfcr 3 # cr7
349+ ; PPC64-NEXT: rlwinm 3, 3, 31, 31, 31
350+ ; PPC64-NEXT: or 4, 3, 4
351+ ; PPC64-NEXT: # implicit-def: $x3
352+ ; PPC64-NEXT: mr 3, 4
353+ ; PPC64-NEXT: clrldi 3, 3, 32
354+ ; PPC64-NEXT: blr
355+ ;
356+ ; PPC64LE-LABEL: ppcf128_soften:
357+ ; PPC64LE: # %bb.0: # %entry
358+ ; PPC64LE-NEXT: li 3, 4095
359+ ; PPC64LE-NEXT: rldic 3, 3, 52, 0
360+ ; PPC64LE-NEXT: cmpd 4, 3
361+ ; PPC64LE-NEXT: crmove 21, 2
362+ ; PPC64LE-NEXT: clrldi. 3, 4, 1
363+ ; PPC64LE-NEXT: crmove 20, 2
364+ ; PPC64LE-NEXT: cror 20, 20, 21
365+ ; PPC64LE-NEXT: li 4, 0
366+ ; PPC64LE-NEXT: li 3, 1
367+ ; PPC64LE-NEXT: isel 3, 3, 4, 20
368+ ; PPC64LE-NEXT: blr
369+ entry:
370+ %fpclass = tail call i1 @llvm.is.fpclass.ppcf128 (ppc_fp128 %a , i32 100 )
371+ ret i1 %fpclass
372+ }
373+
315374; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
316375declare double @llvm.fmuladd.f64 (double , double , double ) #1
376+ declare i1 @llvm.is.fpclass.ppcf128 (ppc_fp128 , i32 immarg) #1
317377
318378attributes #0 = {"use-soft-float" ="true" nounwind }
319379attributes #1 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
0 commit comments