[Bug 2075491] [NEW] binary16 float-point arithmetic crashes LLVM on s390x

Zixing Liu 2075491 at bugs.launchpad.net
Thu Aug 1 06:56:03 UTC 2024


Public bug reported:

binary16 float-point arithmetic crashes LLVM on s390x due to the LLVM
backend being unable to lower the LLVM IR to the machine code.

You can find a short reproducer below:

define noundef zeroext i1 @test_func(half noundef %f) unnamed_addr {
start:
  %self = fdiv half %f, 0xHC700
  %_4 = bitcast half %self to i16
  %_0 = icmp slt i16 %_4, 0
  ret i1 %_0
}


You can save this LLVM IR text to a file called `test-ir.ll` and build it using `clang test-ir.ll -c -o test-ir.o` on a s390x device and watch LLVM explodes with:

warning: overriding the module target triple with s390x-unknown-linux-gnu [-Woverride-module]
fatal error: error in backend: Cannot select: 0x6005f020ae20: i32 = fp_to_fp16 0x6005f020adb0
  0x6005f020adb0: f32 = fdiv 0x6005f020af70, 0x6005f020b4b0
    0x6005f020af70: f32 = fp16_to_fp 0x6005f020b520
      0x6005f020b520: i32 = fp_to_fp16 0x6005f020a9c0
        0x6005f020a9c0: f32,ch = CopyFromReg 0x6005f01e5220, Register:f32 %0
          0x6005f020a950: f32 = Register %0
    0x6005f020b4b0: f32,ch = load<(load (s32) from constant-pool)> 0x6005f01e5220, 0x6005f020b280, undef:i64
      0x6005f020b280: i64 = SystemZISD::PCREL_WRAPPER TargetConstantPool:i64<float -7.000000e+00> 0
        0x6005f020b1a0: i64 = TargetConstantPool<float -7.000000e+00> 0
      0x6005f020b130: i64 = undef
In function: test_func

** Affects: ubuntu-z-systems
     Importance: Medium
     Assignee: bugproxy (bugproxy)
         Status: New

** Affects: llvm-toolchain-18 (Ubuntu)
     Importance: Medium
         Status: New


** Tags: reverse-proxy-bugzilla s390x

-- 
You received this bug notification because you are a member of Ubuntu
Foundations Bugs, which is subscribed to llvm-toolchain-18 in Ubuntu.
https://bugs.launchpad.net/bugs/2075491

Title:
  binary16 float-point arithmetic crashes LLVM on s390x

Status in Ubuntu on IBM z Systems:
  New
Status in llvm-toolchain-18 package in Ubuntu:
  New

Bug description:
  binary16 float-point arithmetic crashes LLVM on s390x due to the LLVM
  backend being unable to lower the LLVM IR to the machine code.

  You can find a short reproducer below:

  define noundef zeroext i1 @test_func(half noundef %f) unnamed_addr {
  start:
    %self = fdiv half %f, 0xHC700
    %_4 = bitcast half %self to i16
    %_0 = icmp slt i16 %_4, 0
    ret i1 %_0
  }

  
  You can save this LLVM IR text to a file called `test-ir.ll` and build it using `clang test-ir.ll -c -o test-ir.o` on a s390x device and watch LLVM explodes with:

  warning: overriding the module target triple with s390x-unknown-linux-gnu [-Woverride-module]
  fatal error: error in backend: Cannot select: 0x6005f020ae20: i32 = fp_to_fp16 0x6005f020adb0
    0x6005f020adb0: f32 = fdiv 0x6005f020af70, 0x6005f020b4b0
      0x6005f020af70: f32 = fp16_to_fp 0x6005f020b520
        0x6005f020b520: i32 = fp_to_fp16 0x6005f020a9c0
          0x6005f020a9c0: f32,ch = CopyFromReg 0x6005f01e5220, Register:f32 %0
            0x6005f020a950: f32 = Register %0
      0x6005f020b4b0: f32,ch = load<(load (s32) from constant-pool)> 0x6005f01e5220, 0x6005f020b280, undef:i64
        0x6005f020b280: i64 = SystemZISD::PCREL_WRAPPER TargetConstantPool:i64<float -7.000000e+00> 0
          0x6005f020b1a0: i64 = TargetConstantPool<float -7.000000e+00> 0
        0x6005f020b130: i64 = undef
  In function: test_func

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu-z-systems/+bug/2075491/+subscriptions




More information about the foundations-bugs mailing list