llvm-project/llvm/test/CodeGen/AMDGPU/knownbits-recursion.ll
Fangrui Song 9e9907f1cf
[AMDGPU,test] Change llc -march= to -mtriple= (#75982)
Similar to 806761a7629df268c8aed49657aeccffa6bca449.

For IR files without a target triple, -mtriple= specifies the full
target triple while -march= merely sets the architecture part of the
default target triple, leaving a target triple which may not make sense,
e.g. amdgpu-apple-darwin.

Therefore, -march= is error-prone and not recommended for tests without
a target triple. The issue has been benign as we recognize
$unknown-apple-darwin as ELF instead of rejecting it outrightly.

This patch changes AMDGPU tests to not rely on the default
OS/environment components. Tests that need fixes are not changed:

```
  LLVM :: CodeGen/AMDGPU/fabs.f64.ll
  LLVM :: CodeGen/AMDGPU/fabs.ll
  LLVM :: CodeGen/AMDGPU/floor.ll
  LLVM :: CodeGen/AMDGPU/fneg-fabs.f64.ll
  LLVM :: CodeGen/AMDGPU/fneg-fabs.ll
  LLVM :: CodeGen/AMDGPU/r600-infinite-loop-bug-while-reorganizing-vector.ll
  LLVM :: CodeGen/AMDGPU/schedule-if-2.ll
```
2024-01-16 21:54:58 -08:00

70 lines
2.4 KiB
LLVM

; RUN: llc -mtriple=amdgcn < %s | FileCheck -check-prefix=GCN %s
; Check we can compile this test without infinite loop in the
; DAG.computeKnownBits() due to missing (Depth + 1) argument in
; call to it from computeKnownBitsForTargetNode().
; Check that we actually have that target 24 bit multiplication
; node produced.
; GCN: v_mul_u32_u24
define amdgpu_kernel void @test(ptr addrspace(1) nocapture %arg) {
bb:
%tmp = tail call i32 @llvm.amdgcn.workitem.id.x()
br label %bb4
bb1: ; preds = %bb4
%tmp3 = getelementptr inbounds i32, ptr addrspace(1) %arg, i32 %tmp46
store i32 %tmp46, ptr addrspace(1) %tmp3, align 4
ret void
bb4: ; preds = %bb4, %bb
%tmp5 = phi i32 [ 0, %bb ], [ %tmp87, %bb4 ]
%tmp6 = phi i32 [ %tmp, %bb ], [ %tmp46, %bb4 ]
%tmp7 = ashr i32 %tmp6, 16
%tmp8 = mul nsw i32 %tmp7, %tmp7
%tmp9 = lshr i32 %tmp8, 16
%tmp10 = mul nuw nsw i32 %tmp9, %tmp9
%tmp11 = lshr i32 %tmp10, 16
%tmp12 = mul nuw nsw i32 %tmp11, %tmp11
%tmp13 = lshr i32 %tmp12, 16
%tmp14 = mul nuw nsw i32 %tmp13, %tmp13
%tmp15 = lshr i32 %tmp14, 16
%tmp16 = mul nuw nsw i32 %tmp15, %tmp15
%tmp17 = lshr i32 %tmp16, 16
%tmp18 = mul nuw nsw i32 %tmp17, %tmp17
%tmp19 = lshr i32 %tmp18, 16
%tmp20 = mul nuw nsw i32 %tmp19, %tmp19
%tmp21 = lshr i32 %tmp20, 16
%tmp22 = mul nuw nsw i32 %tmp21, %tmp21
%tmp23 = lshr i32 %tmp22, 16
%tmp24 = mul nuw nsw i32 %tmp23, %tmp23
%tmp25 = lshr i32 %tmp24, 16
%tmp26 = mul nuw nsw i32 %tmp25, %tmp25
%tmp27 = lshr i32 %tmp26, 16
%tmp28 = mul nuw nsw i32 %tmp27, %tmp27
%tmp29 = lshr i32 %tmp28, 16
%tmp30 = mul nuw nsw i32 %tmp29, %tmp29
%tmp31 = lshr i32 %tmp30, 16
%tmp32 = mul nuw nsw i32 %tmp31, %tmp31
%tmp33 = lshr i32 %tmp32, 16
%tmp34 = mul nuw nsw i32 %tmp33, %tmp33
%tmp35 = lshr i32 %tmp34, 16
%tmp36 = mul nuw nsw i32 %tmp35, %tmp35
%tmp37 = lshr i32 %tmp36, 16
%tmp38 = mul nuw nsw i32 %tmp37, %tmp37
%tmp39 = lshr i32 %tmp38, 16
%tmp40 = mul nuw nsw i32 %tmp39, %tmp39
%tmp41 = lshr i32 %tmp40, 16
%tmp42 = mul nuw nsw i32 %tmp41, %tmp41
%tmp43 = lshr i32 %tmp42, 16
%tmp44 = mul nuw nsw i32 %tmp43, %tmp43
%tmp45 = lshr i32 %tmp44, 16
%tmp46 = mul nuw nsw i32 %tmp45, %tmp45
%tmp87 = add nuw nsw i32 %tmp5, 1
%tmp88 = icmp eq i32 %tmp87, 1000
br i1 %tmp88, label %bb1, label %bb4
}
declare i32 @llvm.amdgcn.workitem.id.x()