This is an archive of the discontinued LLVM Phabricator instance.

[Sparc] Make sure that we really don't emit quad-precision unless the "hard-quad-float" feature is available
ClosedPublic

Authored by brad on Feb 6 2022, 8:39 PM.

Details

Summary

Submitting from the OpenBSD tree and author is @kettenis.

Make sure that we really don't emit quad-precision unless the "hard-quad-float" feature is available. Add missing replacement instruction patterns that are needed to emit alternative code for conditional moves of quad-precision floats.

Diff Detail

Event Timeline

brad created this revision.Feb 6 2022, 8:39 PM
brad requested review of this revision.Feb 6 2022, 8:39 PM
brad updated this revision to Diff 406715.Feb 8 2022, 12:00 AM

trigger another build as some of the tests were timing out on the buildbot

Looks okay here, in particular it doesn't emit FMOVqcc instructions unless hard-quad-float is specified:

define fp128 @fpselect(i32 signext %0, fp128 %1, fp128 %2) {
  %a = icmp eq i32 %0, 0
  %b = select i1 %a, fp128 %2, fp128 %1
  ret fp128 %b
}

Before the patch:

fpselect:
  fmovd %f4, %f0
  fmovd %f6, %f2
  cmp %o0, 0
  retl
   fmovqe %icc, %f8, %f0

After the patch:

fpselect:
  cmp %o0, 0
  fmovd %f8, %f0
  fmovd %f10, %f2
  be .LBB0_2
   nop
  fmovd %f4, %f0
  fmovd %f6, %f2
.LBB0_2:
  retl
   nop

Other instructions seems to not be emitted when in not in hard-quad-float mode, even before the patch, though.
Also, is it possible to add some tests for this?

Herald added a project: Restricted Project. · View Herald TranscriptApr 1 2022, 6:27 PM
brad updated this revision to Diff 429394.May 13 2022, 5:22 PM

Thanks to Koakuma for providing a test.

koakuma accepted this revision.May 18 2022, 4:12 PM

LGTM

This revision is now accepted and ready to land.May 18 2022, 4:12 PM