Home | History | Annotate | Download | only in AMDGPU
      1 ; REQUIRES: asserts
      2 ; XFAIL: *
      3 ; RUN: llc -O0 -verify-machineinstrs -asm-verbose=0 -march=amdgcn -mcpu=SI < %s | FileCheck -check-prefix=SI -check-prefix=COMMON %s
      4 ; RUN: llc -O0 -verify-machineinstrs -asm-verbose=0 -march=amdgcn -mcpu=tonga < %s | FileCheck -check-prefix=SI -check-prefix=COMMON %s
      5 ; RUN: llc -O0 -verify-machineinstrs -asm-verbose=0 -march=r600 -mcpu=redwood < %s | FileCheck -check-prefix=EG -check-prefix=COMMON %s
      6 
      7 ; SI hits an assertion at -O0, evergreen hits a not implemented unreachable.
      8 
      9 ; COMMON-LABEL: {{^}}branch_true:
     10 define void @branch_true(i8 addrspace(1)* nocapture %main, i32 %main_stride) #0 {
     11 entry:
     12   br i1 true, label %for.end, label %for.body.lr.ph
     13 
     14 for.body.lr.ph:                                   ; preds = %entry
     15   %add.ptr.sum = shl i32 %main_stride, 1
     16   %add.ptr1.sum = add i32 %add.ptr.sum, %main_stride
     17   %add.ptr4.sum = shl i32 %main_stride, 2
     18   br label %for.body
     19 
     20 for.body:                                         ; preds = %for.body, %for.body.lr.ph
     21   %main.addr.011 = phi i8 addrspace(1)* [ %main, %for.body.lr.ph ], [ %add.ptr6, %for.body ]
     22   %0 = bitcast i8 addrspace(1)* %main.addr.011 to i32 addrspace(1)*
     23   %1 = load i32, i32 addrspace(1)* %0, align 4
     24   %add.ptr = getelementptr inbounds i8, i8 addrspace(1)* %main.addr.011, i32 %main_stride
     25   %2 = bitcast i8 addrspace(1)* %add.ptr to i32 addrspace(1)*
     26   %3 = load i32, i32 addrspace(1)* %2, align 4
     27   %add.ptr1 = getelementptr inbounds i8, i8 addrspace(1)* %main.addr.011, i32 %add.ptr.sum
     28   %4 = bitcast i8 addrspace(1)* %add.ptr1 to i32 addrspace(1)*
     29   %5 = load i32, i32 addrspace(1)* %4, align 4
     30   %add.ptr2 = getelementptr inbounds i8, i8 addrspace(1)* %main.addr.011, i32 %add.ptr1.sum
     31   %6 = bitcast i8 addrspace(1)* %add.ptr2 to i32 addrspace(1)*
     32   %7 = load i32, i32 addrspace(1)* %6, align 4
     33   %add.ptr3 = getelementptr inbounds i8, i8 addrspace(1)* %main.addr.011, i32 %add.ptr4.sum
     34   %8 = bitcast i8 addrspace(1)* %add.ptr3 to i32 addrspace(1)*
     35   %9 = load i32, i32 addrspace(1)* %8, align 4
     36   %add.ptr6 = getelementptr inbounds i8, i8 addrspace(1)* %main.addr.011, i32 undef
     37   br i1 undef, label %for.end, label %for.body
     38 
     39 for.end:                                          ; preds = %for.body, %entry
     40   ret void
     41 }
     42 
     43 ; COMMON-LABEL: {{^}}branch_false:
     44 ; SI: .text
     45 ; SI-NEXT: s_endpgm
     46 define void @branch_false(i8 addrspace(1)* nocapture %main, i32 %main_stride) #0 {
     47 entry:
     48   br i1 false, label %for.end, label %for.body.lr.ph
     49 
     50 for.body.lr.ph:                                   ; preds = %entry
     51   %add.ptr.sum = shl i32 %main_stride, 1
     52   %add.ptr1.sum = add i32 %add.ptr.sum, %main_stride
     53   %add.ptr4.sum = shl i32 %main_stride, 2
     54   br label %for.body
     55 
     56 for.body:                                         ; preds = %for.body, %for.body.lr.ph
     57   %main.addr.011 = phi i8 addrspace(1)* [ %main, %for.body.lr.ph ], [ %add.ptr6, %for.body ]
     58   %0 = bitcast i8 addrspace(1)* %main.addr.011 to i32 addrspace(1)*
     59   %1 = load i32, i32 addrspace(1)* %0, align 4
     60   %add.ptr = getelementptr inbounds i8, i8 addrspace(1)* %main.addr.011, i32 %main_stride
     61   %2 = bitcast i8 addrspace(1)* %add.ptr to i32 addrspace(1)*
     62   %3 = load i32, i32 addrspace(1)* %2, align 4
     63   %add.ptr1 = getelementptr inbounds i8, i8 addrspace(1)* %main.addr.011, i32 %add.ptr.sum
     64   %4 = bitcast i8 addrspace(1)* %add.ptr1 to i32 addrspace(1)*
     65   %5 = load i32, i32 addrspace(1)* %4, align 4
     66   %add.ptr2 = getelementptr inbounds i8, i8 addrspace(1)* %main.addr.011, i32 %add.ptr1.sum
     67   %6 = bitcast i8 addrspace(1)* %add.ptr2 to i32 addrspace(1)*
     68   %7 = load i32, i32 addrspace(1)* %6, align 4
     69   %add.ptr3 = getelementptr inbounds i8, i8 addrspace(1)* %main.addr.011, i32 %add.ptr4.sum
     70   %8 = bitcast i8 addrspace(1)* %add.ptr3 to i32 addrspace(1)*
     71   %9 = load i32, i32 addrspace(1)* %8, align 4
     72   %add.ptr6 = getelementptr inbounds i8, i8 addrspace(1)* %main.addr.011, i32 undef
     73   br i1 undef, label %for.end, label %for.body
     74 
     75 for.end:                                          ; preds = %for.body, %entry
     76   ret void
     77 }
     78 
     79 ; COMMON-LABEL: {{^}}branch_undef:
     80 ; SI: .text
     81 ; SI-NEXT: s_endpgm
     82 define void @branch_undef(i8 addrspace(1)* nocapture %main, i32 %main_stride) #0 {
     83 entry:
     84   br i1 undef, label %for.end, label %for.body.lr.ph
     85 
     86 for.body.lr.ph:                                   ; preds = %entry
     87   %add.ptr.sum = shl i32 %main_stride, 1
     88   %add.ptr1.sum = add i32 %add.ptr.sum, %main_stride
     89   %add.ptr4.sum = shl i32 %main_stride, 2
     90   br label %for.body
     91 
     92 for.body:                                         ; preds = %for.body, %for.body.lr.ph
     93   %main.addr.011 = phi i8 addrspace(1)* [ %main, %for.body.lr.ph ], [ %add.ptr6, %for.body ]
     94   %0 = bitcast i8 addrspace(1)* %main.addr.011 to i32 addrspace(1)*
     95   %1 = load i32, i32 addrspace(1)* %0, align 4
     96   %add.ptr = getelementptr inbounds i8, i8 addrspace(1)* %main.addr.011, i32 %main_stride
     97   %2 = bitcast i8 addrspace(1)* %add.ptr to i32 addrspace(1)*
     98   %3 = load i32, i32 addrspace(1)* %2, align 4
     99   %add.ptr1 = getelementptr inbounds i8, i8 addrspace(1)* %main.addr.011, i32 %add.ptr.sum
    100   %4 = bitcast i8 addrspace(1)* %add.ptr1 to i32 addrspace(1)*
    101   %5 = load i32, i32 addrspace(1)* %4, align 4
    102   %add.ptr2 = getelementptr inbounds i8, i8 addrspace(1)* %main.addr.011, i32 %add.ptr1.sum
    103   %6 = bitcast i8 addrspace(1)* %add.ptr2 to i32 addrspace(1)*
    104   %7 = load i32, i32 addrspace(1)* %6, align 4
    105   %add.ptr3 = getelementptr inbounds i8, i8 addrspace(1)* %main.addr.011, i32 %add.ptr4.sum
    106   %8 = bitcast i8 addrspace(1)* %add.ptr3 to i32 addrspace(1)*
    107   %9 = load i32, i32 addrspace(1)* %8, align 4
    108   %add.ptr6 = getelementptr inbounds i8, i8 addrspace(1)* %main.addr.011, i32 undef
    109   br i1 undef, label %for.end, label %for.body
    110 
    111 for.end:                                          ; preds = %for.body, %entry
    112   ret void
    113 }
    114 
    115 attributes #0 = { nounwind }
    116