|
| 1 | +; RUN: opt -force-vector-interleave=2 -force-vector-width=4 -loop-vectorize -pass-remarks-analysis=loop-vectorize -disable-output < %s 2>&1 | FileCheck %s |
| 2 | + |
| 3 | +; CHECK: remark: mixed-precision.c:3:26: floating point conversion changes vector width. Mixed floating point precision requires an up/down cast that will negatively impact performance. |
| 4 | +define void @f(float* noalias nocapture %X, i64 %N) { |
| 5 | +entry: |
| 6 | + br label %for.body |
| 7 | + |
| 8 | +for.cond.cleanup: |
| 9 | + ret void |
| 10 | + |
| 11 | +for.body: |
| 12 | + %i = phi i64 [ %inc, %for.body ], [ 0, %entry ] |
| 13 | + %arrayidx = getelementptr inbounds float, float* %X, i64 %i |
| 14 | + %0 = load float, float* %arrayidx, align 4 |
| 15 | + %conv = fpext float %0 to double, !dbg !9 |
| 16 | + %mul = fmul double %conv, 0x3FD5555555555555 |
| 17 | + %conv3 = fptrunc double %mul to float |
| 18 | + store float %conv3, float* %arrayidx, align 4 |
| 19 | + %inc = add nuw i64 %i, 1 |
| 20 | + %exitcond.not = icmp eq i64 %inc, %N |
| 21 | + br i1 %exitcond.not, label %for.cond.cleanup, label %for.body |
| 22 | +} |
| 23 | + |
| 24 | +; CHECK: remark: mixed-precision.c:8:8: floating point conversion changes vector width. Mixed floating point precision requires an up/down cast that will negatively impact performance. |
| 25 | +; CHECK: remark: mixed-precision.c:7:16: floating point conversion changes vector width. Mixed floating point precision requires an up/down cast that will negatively impact performance. |
| 26 | +; CHECK-NOT: remark: mixed-precision.c:7:16: floating point conversion changes vector width. Mixed floating point precision requires an up/down cast that will negatively impact performance. |
| 27 | +define void @g(float* noalias nocapture %X, float* noalias nocapture %Y, i64 %N) { |
| 28 | +entry: |
| 29 | + %pi = alloca double |
| 30 | + store double 0x400921FB54442D18, double* %pi |
| 31 | + %fac = load double, double* %pi |
| 32 | + br label %for.body |
| 33 | + |
| 34 | +for.body: |
| 35 | + %i = phi i64 [ %inc, %for.body ], [ 0, %entry ] |
| 36 | + %arrayidx = getelementptr inbounds float, float* %X, i64 %i |
| 37 | + %0 = load float, float* %arrayidx, align 4 |
| 38 | + %conv = fpext float %0 to double, !dbg !10 |
| 39 | + %mul = fmul double %conv, %fac |
| 40 | + %conv1 = fptrunc double %mul to float |
| 41 | + store float %conv1, float* %arrayidx, align 4 |
| 42 | + %arrayidx5 = getelementptr inbounds float, float* %Y, i64 %i |
| 43 | + %1 = load float, float* %arrayidx5, align 4 |
| 44 | + %conv2 = fpext float %1 to double, !dbg !11 |
| 45 | + %mul2 = fmul double %conv2, %fac |
| 46 | + %conv3 = fptrunc double %mul2 to float |
| 47 | + store float %conv3, float* %arrayidx5, align 4 |
| 48 | + %inc = add nuw nsw i64 %i, 1 |
| 49 | + %exitcond.not = icmp eq i64 %inc, %N |
| 50 | + br i1 %exitcond.not, label %for.cond.cleanup, label %for.body |
| 51 | + |
| 52 | +for.cond.cleanup: |
| 53 | + ret void |
| 54 | +} |
| 55 | + |
| 56 | +!llvm.dbg.cu = !{!0} |
| 57 | +!llvm.module.flags = !{!3, !4} |
| 58 | + |
| 59 | +!0 = distinct !DICompileUnit(language: DW_LANG_C99, file: !1, producer: "clang version 12.0.0", isOptimized: true, runtimeVersion: 0, emissionKind: NoDebug, enums: !2, splitDebugInlining: false, nameTableKind: None) |
| 60 | +!1 = !DIFile(filename: "mixed-precision.c", directory: "/tmp/mixed-precision.c") |
| 61 | +!2 = !{} |
| 62 | +!3 = !{i32 2, !"Debug Info Version", i32 3} |
| 63 | +!4 = !{i32 1, !"wchar_size", i32 4} |
| 64 | +!6 = distinct !DISubprogram(name: "f", scope: !1, file: !1, line: 1, type: !8, scopeLine: 1, flags: DIFlagPrototyped, spFlags: DISPFlagDefinition | DISPFlagOptimized, unit: !0, retainedNodes: !2) |
| 65 | +!7 = distinct !DISubprogram(name: "g", scope: !1, file: !1, line: 5, type: !8, scopeLine: 5, flags: DIFlagPrototyped, spFlags: DISPFlagDefinition | DISPFlagOptimized, unit: !0, retainedNodes: !2) |
| 66 | +!8 = !DISubroutineType(types: !2) |
| 67 | +!9 = !DILocation(line: 3, column: 26, scope: !6) |
| 68 | +!10 = !DILocation(line: 7, column: 16, scope: !7) |
| 69 | +!11 = !DILocation(line: 8, column: 8, scope: !7) |
0 commit comments