|
| 1 | +;=========================== begin_copyright_notice ============================ |
| 2 | +; |
| 3 | +; Copyright (C) 2024 Intel Corporation |
| 4 | +; |
| 5 | +; SPDX-License-Identifier: MIT |
| 6 | +; |
| 7 | +;============================ end_copyright_notice ============================= |
| 8 | +; |
| 9 | +; REQUIRES: llvm-14-plus |
| 10 | +; RUN: igc_opt --opaque-pointers -debugify -igc-custom-loop-opt -S < %s 2>&1 | FileCheck %s |
| 11 | +; ------------------------------------------------ |
| 12 | +; CustomLoopVersioning |
| 13 | +; ------------------------------------------------ |
| 14 | + |
| 15 | +; This test checks that we're not creating a cmp inst with mismatched fp types. |
| 16 | + |
| 17 | +define spir_kernel void @test_customloop(ptr addrspace(65549) %a, double %b, double %c, double %d) { |
| 18 | +entry: |
| 19 | + %aa = inttoptr i32 42 to ptr addrspace(65549) |
| 20 | + %cc = call double @llvm.maxnum.f64(double %c, double 3.000000e+00) |
| 21 | + %dd = call double @llvm.minnum.f64(double %d, double 2.000000e+00) |
| 22 | + br label %pre_header |
| 23 | + |
| 24 | +pre_header: |
| 25 | + ; CHECK: [[TMP:%.*]] = load double |
| 26 | + %0 = load double, ptr addrspace(65549) %aa, align 4 |
| 27 | + %1 = fmul double %b, %0 |
| 28 | + ; CHECK: fcmp fast ogt double [[TMP]], 1.000000e+00 |
| 29 | + br label %loop_body |
| 30 | + |
| 31 | +loop_body: |
| 32 | + %2 = phi double [ %b, %pre_header ], [ %3, %loop_body ] |
| 33 | + %3 = phi double [ %1, %pre_header ], [ %7, %loop_body ] |
| 34 | + %4 = call double @llvm.maxnum.f64(double %cc, double %2) |
| 35 | + %5 = call double @llvm.minnum.f64(double %dd, double %3) |
| 36 | + %6 = load double, ptr addrspace(65549) %aa, align 4 |
| 37 | + %7 = fmul double %3, %6 |
| 38 | + %8 = fcmp ult double %3, %dd |
| 39 | + br i1 %8, label %loop_body, label %end |
| 40 | + |
| 41 | +end: |
| 42 | + store double %3, ptr addrspace(65549) %a, align 4 |
| 43 | + ret void |
| 44 | +} |
| 45 | + |
| 46 | + |
| 47 | +declare double @llvm.maxnum.f64(double, double) #0 |
| 48 | +declare double @llvm.minnum.f64(double, double) #0 |
| 49 | + |
| 50 | +!igc.functions = !{!0} |
| 51 | + |
| 52 | +!0 = !{ptr @test_customloop, !1} |
| 53 | +!1 = !{!2} |
| 54 | +!2 = !{!"function_type", i32 0} |
0 commit comments