Issue 75714
Summary i128: "Unexpected truncation" failure in SystemZDAGToDAGISel::getAddressOperands()
Labels backend:SystemZ
Assignees uweigand
Reporter JonPsson1
    Another test case with problem truncating from i128:

```
@safe_rshift_func_uint8_t_u_u_left = dso_local local_unnamed_addr global i8 0, align 2
@func_54_p_58 = dso_local local_unnamed_addr global i32 0, align 4
@g_38_0_0 = internal global i32 0, align 4
@g_76 = internal unnamed_addr global i128 6, align 8

define dso_local void @main() {
entry:
 %g_76.promoted13.i.i.i = load i128, ptr @g_76, align 8
  %0 = add i128 %g_76.promoted13.i.i.i, 5
  store i128 %0, ptr @g_76, align 8
  store i32 6, ptr @func_54_p_58, align 4
  %cmp6.i.i = icmp ugt i128 %0, 7
 %1 = load i8, ptr @safe_rshift_func_uint8_t_u_u_left, align 2
  %conv8.i.i = zext i8 %1 to i32
  %sh_prom.i.i = trunc i128 %0 to i32
  %shr.i.i = lshr i32 %conv8.i.i, %sh_prom.i.i
  %conv10.i.i = select i1 %cmp6.i.i, i32 0, i32 %shr.i.i
  store i32 %conv10.i.i, ptr @g_38_0_0, align 4
  ret void
}
```

llc -mtriple=s390x-linux-gnu -mcpu=z13 tcAM.ll
SystemZDAGToDAGISel::getAddressOperands(const {anonymous}::SystemZAddressingMode&, llvm::EVT, llvm::SDValue&, llvm::SDValue&) const: Assertion `VT == MVT::i32 && Base.getValueType() == MVT::i64 && "Unexpected truncation"' failed.

SelectCode(Node):
```
(gdb) p CurDAG->dump()
SelectionDAG has 30 nodes:
  t0: ch,glue = EntryToken
  t45: i64 = SystemZISD::PCREL_WRAPPER TargetGlobalAddress:i64<ptr @g_76> 0
    t41: i64 = SystemZISD::PCREL_WRAPPER TargetGlobalAddress:i64<ptr @safe_rshift_func_uint8_t_u_u_left> 0
  t28: i32,ch = load<(dereferenceable load (s8) from @safe_rshift_func_uint8_t_u_u_left, align 2), zext from i8> t0, t41, undef:i64
  t4: i128,ch = load<(dereferenceable load (s128) from @g_76, align 8)> t0, t45, undef:i64
  t6: i128 = add t4, Constant:i128<5>
  t46: i32 = TargetConstant<0>
            t17: i32 = truncate t6
          t18: i32 = srl t28, t17
            t34: i32 = SystemZISD::UCMP128HI t6, Constant:i128<7>
          t49: ch,glue = CopyToReg t0, Register:i32 $cc, t34
        t37: i32 = LOCHIMux t18, TargetConstant:i64<0>, TargetConstant:i32<15>, TargetConstant:i32<4>, t49:1
      t24: ch = STRL<Mem:(store (s32) into @g_38_0_0)> t37, TargetGlobalAddress:i64<ptr @g_38_0_0> 0, t0
      t7: ch = store<(store (s128) into @g_76, align 8)> t4:1, t6, t45, undef:i64
        t43: i64 = SystemZISD::PCREL_WRAPPER TargetGlobalAddress:i64<ptr @func_54_p_58> 0
      t31: ch = store<(store (s32) into @func_54_p_58)> t0, Constant:i32<6>, t43, undef:i64
    t33: ch = TokenFactor t24, t28:1, t7, t31
  t23: ch = Return t33


$233 = void
(gdb) p Node->dump()
t18: i32 = srl t28, t17
```


_______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to