diff --git a/llvm/test/Analysis/CostModel/AArch64/div.ll b/llvm/test/Analysis/CostModel/AArch64/div.ll index 50f7117c0f8b..2dff4631288c 100644 --- a/llvm/test/Analysis/CostModel/AArch64/div.ll +++ b/llvm/test/Analysis/CostModel/AArch64/div.ll @@ -1,38 +1,604 @@ -; RUN: opt -cost-model -analyze -mtriple=aarch64--linux-gnu < %s | FileCheck %s +; NOTE: Assertions have been autogenerated by utils/update_analyze_test_checks.py +; RUN: opt < %s -mtriple=aarch64-unknown-linux-gnu -cost-model -analyze | FileCheck %s -; Verify the cost of integer division instructions. +define i32 @sdiv() { +; CHECK-LABEL: 'sdiv' +; CHECK-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %I64 = sdiv i64 undef, undef +; CHECK-NEXT: Cost Model: Found an estimated cost of 24 for instruction: %V2i64 = sdiv <2 x i64> undef, undef +; CHECK-NEXT: Cost Model: Found an estimated cost of 48 for instruction: %V4i64 = sdiv <4 x i64> undef, undef +; CHECK-NEXT: Cost Model: Found an estimated cost of 96 for instruction: %V8i64 = sdiv <8 x i64> undef, undef +; CHECK-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %I32 = sdiv i32 undef, undef +; CHECK-NEXT: Cost Model: Found an estimated cost of 52 for instruction: %V4i32 = sdiv <4 x i32> undef, undef +; CHECK-NEXT: Cost Model: Found an estimated cost of 104 for instruction: %V8i32 = sdiv <8 x i32> undef, undef +; CHECK-NEXT: Cost Model: Found an estimated cost of 208 for instruction: %V16i32 = sdiv <16 x i32> undef, undef +; CHECK-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %I16 = sdiv i16 undef, undef +; CHECK-NEXT: Cost Model: Found an estimated cost of 108 for instruction: %V8i16 = sdiv <8 x i16> undef, undef +; CHECK-NEXT: Cost Model: Found an estimated cost of 216 for instruction: %V16i16 = sdiv <16 x i16> undef, undef +; CHECK-NEXT: Cost Model: Found an estimated cost of 432 for instruction: %V32i16 = sdiv <32 x i16> undef, undef +; CHECK-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %I8 = sdiv i8 undef, undef +; CHECK-NEXT: Cost Model: Found an estimated cost of 220 for instruction: %V16i8 = sdiv <16 x i8> undef, undef +; CHECK-NEXT: Cost Model: Found an estimated cost of 440 for instruction: %V32i8 = sdiv <32 x i8> undef, undef +; CHECK-NEXT: Cost Model: Found an estimated cost of 880 for instruction: %V64i8 = sdiv <64 x i8> undef, undef +; CHECK-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret i32 undef +; + %I64 = sdiv i64 undef, undef + %V2i64 = sdiv <2 x i64> undef, undef + %V4i64 = sdiv <4 x i64> undef, undef + %V8i64 = sdiv <8 x i64> undef, undef -define i32 @sdivs1i32(i32 %a, i32 %b) { -; CHECK-LABEL: 'Cost Model Analysis' for function 'sdivs1i32': -; CHECK: Found an estimated cost of 1 for instruction: %c = sdiv i32 %a, %b - %c = sdiv i32 %a, %b - ret i32 %c + %I32 = sdiv i32 undef, undef + %V4i32 = sdiv <4 x i32> undef, undef + %V8i32 = sdiv <8 x i32> undef, undef + %V16i32 = sdiv <16 x i32> undef, undef + + %I16 = sdiv i16 undef, undef + %V8i16 = sdiv <8 x i16> undef, undef + %V16i16 = sdiv <16 x i16> undef, undef + %V32i16 = sdiv <32 x i16> undef, undef + + %I8 = sdiv i8 undef, undef + %V16i8 = sdiv <16 x i8> undef, undef + %V32i8 = sdiv <32 x i8> undef, undef + %V64i8 = sdiv <64 x i8> undef, undef + + ret i32 undef } -define i64 @sdivs1i64(i64 %a, i64 %b) { -; CHECK-LABEL: 'Cost Model Analysis' for function 'sdivs1i64': -; CHECK: Found an estimated cost of 1 for instruction: %c = sdiv i64 %a, %b - %c = sdiv i64 %a, %b - ret i64 %c +define i32 @udiv() { +; CHECK-LABEL: 'udiv' +; CHECK-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %I64 = udiv i64 undef, undef +; CHECK-NEXT: Cost Model: Found an estimated cost of 24 for instruction: %V2i64 = udiv <2 x i64> undef, undef +; CHECK-NEXT: Cost Model: Found an estimated cost of 48 for instruction: %V4i64 = udiv <4 x i64> undef, undef +; CHECK-NEXT: Cost Model: Found an estimated cost of 96 for instruction: %V8i64 = udiv <8 x i64> undef, undef +; CHECK-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %I32 = udiv i32 undef, undef +; CHECK-NEXT: Cost Model: Found an estimated cost of 52 for instruction: %V4i32 = udiv <4 x i32> undef, undef +; CHECK-NEXT: Cost Model: Found an estimated cost of 104 for instruction: %V8i32 = udiv <8 x i32> undef, undef +; CHECK-NEXT: Cost Model: Found an estimated cost of 208 for instruction: %V16i32 = udiv <16 x i32> undef, undef +; CHECK-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %I16 = udiv i16 undef, undef +; CHECK-NEXT: Cost Model: Found an estimated cost of 108 for instruction: %V8i16 = udiv <8 x i16> undef, undef +; CHECK-NEXT: Cost Model: Found an estimated cost of 216 for instruction: %V16i16 = udiv <16 x i16> undef, undef +; CHECK-NEXT: Cost Model: Found an estimated cost of 432 for instruction: %V32i16 = udiv <32 x i16> undef, undef +; CHECK-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %I8 = udiv i8 undef, undef +; CHECK-NEXT: Cost Model: Found an estimated cost of 220 for instruction: %V16i8 = udiv <16 x i8> undef, undef +; CHECK-NEXT: Cost Model: Found an estimated cost of 440 for instruction: %V32i8 = udiv <32 x i8> undef, undef +; CHECK-NEXT: Cost Model: Found an estimated cost of 880 for instruction: %V64i8 = udiv <64 x i8> undef, undef +; CHECK-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret i32 undef +; + %I64 = udiv i64 undef, undef + %V2i64 = udiv <2 x i64> undef, undef + %V4i64 = udiv <4 x i64> undef, undef + %V8i64 = udiv <8 x i64> undef, undef + + %I32 = udiv i32 undef, undef + %V4i32 = udiv <4 x i32> undef, undef + %V8i32 = udiv <8 x i32> undef, undef + %V16i32 = udiv <16 x i32> undef, undef + + %I16 = udiv i16 undef, undef + %V8i16 = udiv <8 x i16> undef, undef + %V16i16 = udiv <16 x i16> undef, undef + %V32i16 = udiv <32 x i16> undef, undef + + %I8 = udiv i8 undef, undef + %V16i8 = udiv <16 x i8> undef, undef + %V32i8 = udiv <32 x i8> undef, undef + %V64i8 = udiv <64 x i8> undef, undef + + ret i32 undef } -define <2 x i32> @sdivv2i32(<2 x i32> %a, <2 x i32> %b) { -; CHECK-LABEL: 'Cost Model Analysis' for function 'sdivv2i32': -; CHECK: Found an estimated cost of 24 for instruction: %c = sdiv <2 x i32> %a, %b - %c = sdiv <2 x i32> %a, %b - ret <2 x i32> %c +define i32 @sdiv_const() { +; CHECK-LABEL: 'sdiv_const' +; CHECK-NEXT: Cost Model: Found an estimated cost of 7 for instruction: %I64 = sdiv i64 undef, 7 +; CHECK-NEXT: Cost Model: Found an estimated cost of 24 for instruction: %V2i64 = sdiv <2 x i64> undef, +; CHECK-NEXT: Cost Model: Found an estimated cost of 48 for instruction: %V4i64 = sdiv <4 x i64> undef, +; CHECK-NEXT: Cost Model: Found an estimated cost of 96 for instruction: %V8i64 = sdiv <8 x i64> undef, +; CHECK-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %I32 = sdiv i32 undef, 7 +; CHECK-NEXT: Cost Model: Found an estimated cost of 52 for instruction: %V4i32 = sdiv <4 x i32> undef, +; CHECK-NEXT: Cost Model: Found an estimated cost of 104 for instruction: %V8i32 = sdiv <8 x i32> undef, +; CHECK-NEXT: Cost Model: Found an estimated cost of 208 for instruction: %V16i32 = sdiv <16 x i32> undef, +; CHECK-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %I16 = sdiv i16 undef, 7 +; CHECK-NEXT: Cost Model: Found an estimated cost of 108 for instruction: %V8i16 = sdiv <8 x i16> undef, +; CHECK-NEXT: Cost Model: Found an estimated cost of 216 for instruction: %V16i16 = sdiv <16 x i16> undef, +; CHECK-NEXT: Cost Model: Found an estimated cost of 432 for instruction: %V32i16 = sdiv <32 x i16> undef, +; CHECK-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %I8 = sdiv i8 undef, 7 +; CHECK-NEXT: Cost Model: Found an estimated cost of 220 for instruction: %V16i8 = sdiv <16 x i8> undef, +; CHECK-NEXT: Cost Model: Found an estimated cost of 440 for instruction: %V32i8 = sdiv <32 x i8> undef, +; CHECK-NEXT: Cost Model: Found an estimated cost of 880 for instruction: %V64i8 = sdiv <64 x i8> undef, +; CHECK-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret i32 undef +; + %I64 = sdiv i64 undef, 7 + %V2i64 = sdiv <2 x i64> undef, + %V4i64 = sdiv <4 x i64> undef, + %V8i64 = sdiv <8 x i64> undef, + + %I32 = sdiv i32 undef, 7 + %V4i32 = sdiv <4 x i32> undef, + %V8i32 = sdiv <8 x i32> undef, + %V16i32 = sdiv <16 x i32> undef, + + %I16 = sdiv i16 undef, 7 + %V8i16 = sdiv <8 x i16> undef, + %V16i16 = sdiv <16 x i16> undef, + %V32i16 = sdiv <32 x i16> undef, + + %I8 = sdiv i8 undef, 7 + %V16i8 = sdiv <16 x i8> undef, + %V32i8 = sdiv <32 x i8> undef, + %V64i8 = sdiv <64 x i8> undef, + + ret i32 undef } -define <2 x i64> @sdivv2i64(<2 x i64> %a, <2 x i64> %b) { -; CHECK-LABEL: 'Cost Model Analysis' for function 'sdivv2i64': -; CHECK: Found an estimated cost of 24 for instruction: %c = sdiv <2 x i64> %a, %b - %c = sdiv <2 x i64> %a, %b - ret <2 x i64> %c +define i32 @udiv_const() { +; CHECK-LABEL: 'udiv_const' +; CHECK-NEXT: Cost Model: Found an estimated cost of 7 for instruction: %I64 = udiv i64 undef, 7 +; CHECK-NEXT: Cost Model: Found an estimated cost of 24 for instruction: %V2i64 = udiv <2 x i64> undef, +; CHECK-NEXT: Cost Model: Found an estimated cost of 48 for instruction: %V4i64 = udiv <4 x i64> undef, +; CHECK-NEXT: Cost Model: Found an estimated cost of 96 for instruction: %V8i64 = udiv <8 x i64> undef, +; CHECK-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %I32 = udiv i32 undef, 7 +; CHECK-NEXT: Cost Model: Found an estimated cost of 52 for instruction: %V4i32 = udiv <4 x i32> undef, +; CHECK-NEXT: Cost Model: Found an estimated cost of 104 for instruction: %V8i32 = udiv <8 x i32> undef, +; CHECK-NEXT: Cost Model: Found an estimated cost of 208 for instruction: %V16i32 = udiv <16 x i32> undef, +; CHECK-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %I16 = udiv i16 undef, 7 +; CHECK-NEXT: Cost Model: Found an estimated cost of 108 for instruction: %V8i16 = udiv <8 x i16> undef, +; CHECK-NEXT: Cost Model: Found an estimated cost of 216 for instruction: %V16i16 = udiv <16 x i16> undef, +; CHECK-NEXT: Cost Model: Found an estimated cost of 432 for instruction: %V32i16 = udiv <32 x i16> undef, +; CHECK-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %I8 = udiv i8 undef, 7 +; CHECK-NEXT: Cost Model: Found an estimated cost of 220 for instruction: %V16i8 = udiv <16 x i8> undef, +; CHECK-NEXT: Cost Model: Found an estimated cost of 440 for instruction: %V32i8 = udiv <32 x i8> undef, +; CHECK-NEXT: Cost Model: Found an estimated cost of 880 for instruction: %V64i8 = udiv <64 x i8> undef, +; CHECK-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret i32 undef +; + %I64 = udiv i64 undef, 7 + %V2i64 = udiv <2 x i64> undef, + %V4i64 = udiv <4 x i64> undef, + %V8i64 = udiv <8 x i64> undef, + + %I32 = udiv i32 undef, 7 + %V4i32 = udiv <4 x i32> undef, + %V8i32 = udiv <8 x i32> undef, + %V16i32 = udiv <16 x i32> undef, + + %I16 = udiv i16 undef, 7 + %V8i16 = udiv <8 x i16> undef, + %V16i16 = udiv <16 x i16> undef, + %V32i16 = udiv <32 x i16> undef, + + %I8 = udiv i8 undef, 7 + %V16i8 = udiv <16 x i8> undef, + %V32i8 = udiv <32 x i8> undef, + %V64i8 = udiv <64 x i8> undef, + + ret i32 undef } -define <4 x i32> @sdivv4i32(<4 x i32> %a, <4 x i32> %b) { -; CHECK-LABEL: 'Cost Model Analysis' for function 'sdivv4i32': -; CHECK: Found an estimated cost of 52 for instruction: %c = sdiv <4 x i32> %a, %b - %c = sdiv <4 x i32> %a, %b - ret <4 x i32> %c +define i32 @sdiv_uniformconst() { +; CHECK-LABEL: 'sdiv_uniformconst' +; CHECK-NEXT: Cost Model: Found an estimated cost of 7 for instruction: %I64 = sdiv i64 undef, 7 +; CHECK-NEXT: Cost Model: Found an estimated cost of 48 for instruction: %V2i64 = sdiv <2 x i64> undef, +; CHECK-NEXT: Cost Model: Found an estimated cost of 96 for instruction: %V4i64 = sdiv <4 x i64> undef, +; CHECK-NEXT: Cost Model: Found an estimated cost of 192 for instruction: %V8i64 = sdiv <8 x i64> undef, +; CHECK-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %I32 = sdiv i32 undef, 7 +; CHECK-NEXT: Cost Model: Found an estimated cost of 9 for instruction: %V4i32 = sdiv <4 x i32> undef, +; CHECK-NEXT: Cost Model: Found an estimated cost of 104 for instruction: %V8i32 = sdiv <8 x i32> undef, +; CHECK-NEXT: Cost Model: Found an estimated cost of 208 for instruction: %V16i32 = sdiv <16 x i32> undef, +; CHECK-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %I16 = sdiv i16 undef, 7 +; CHECK-NEXT: Cost Model: Found an estimated cost of 9 for instruction: %V8i16 = sdiv <8 x i16> undef, +; CHECK-NEXT: Cost Model: Found an estimated cost of 216 for instruction: %V16i16 = sdiv <16 x i16> undef, +; CHECK-NEXT: Cost Model: Found an estimated cost of 432 for instruction: %V32i16 = sdiv <32 x i16> undef, +; CHECK-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %I8 = sdiv i8 undef, 7 +; CHECK-NEXT: Cost Model: Found an estimated cost of 9 for instruction: %V16i8 = sdiv <16 x i8> undef, +; CHECK-NEXT: Cost Model: Found an estimated cost of 440 for instruction: %V32i8 = sdiv <32 x i8> undef, +; CHECK-NEXT: Cost Model: Found an estimated cost of 880 for instruction: %V64i8 = sdiv <64 x i8> undef, +; CHECK-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret i32 undef +; + %I64 = sdiv i64 undef, 7 + %V2i64 = sdiv <2 x i64> undef, + %V4i64 = sdiv <4 x i64> undef, + %V8i64 = sdiv <8 x i64> undef, + + %I32 = sdiv i32 undef, 7 + %V4i32 = sdiv <4 x i32> undef, + %V8i32 = sdiv <8 x i32> undef, + %V16i32 = sdiv <16 x i32> undef, + + %I16 = sdiv i16 undef, 7 + %V8i16 = sdiv <8 x i16> undef, + %V16i16 = sdiv <16 x i16> undef, + %V32i16 = sdiv <32 x i16> undef, + + %I8 = sdiv i8 undef, 7 + %V16i8 = sdiv <16 x i8> undef, + %V32i8 = sdiv <32 x i8> undef, + %V64i8 = sdiv <64 x i8> undef, + + ret i32 undef +} + +define i32 @udiv_uniformconst() { +; CHECK-LABEL: 'udiv_uniformconst' +; CHECK-NEXT: Cost Model: Found an estimated cost of 7 for instruction: %I64 = udiv i64 undef, 7 +; CHECK-NEXT: Cost Model: Found an estimated cost of 48 for instruction: %V2i64 = udiv <2 x i64> undef, +; CHECK-NEXT: Cost Model: Found an estimated cost of 96 for instruction: %V4i64 = udiv <4 x i64> undef, +; CHECK-NEXT: Cost Model: Found an estimated cost of 192 for instruction: %V8i64 = udiv <8 x i64> undef, +; CHECK-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %I32 = udiv i32 undef, 7 +; CHECK-NEXT: Cost Model: Found an estimated cost of 9 for instruction: %V4i32 = udiv <4 x i32> undef, +; CHECK-NEXT: Cost Model: Found an estimated cost of 104 for instruction: %V8i32 = udiv <8 x i32> undef, +; CHECK-NEXT: Cost Model: Found an estimated cost of 208 for instruction: %V16i32 = udiv <16 x i32> undef, +; CHECK-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %I16 = udiv i16 undef, 7 +; CHECK-NEXT: Cost Model: Found an estimated cost of 9 for instruction: %V8i16 = udiv <8 x i16> undef, +; CHECK-NEXT: Cost Model: Found an estimated cost of 216 for instruction: %V16i16 = udiv <16 x i16> undef, +; CHECK-NEXT: Cost Model: Found an estimated cost of 432 for instruction: %V32i16 = udiv <32 x i16> undef, +; CHECK-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %I8 = udiv i8 undef, 7 +; CHECK-NEXT: Cost Model: Found an estimated cost of 9 for instruction: %V16i8 = udiv <16 x i8> undef, +; CHECK-NEXT: Cost Model: Found an estimated cost of 440 for instruction: %V32i8 = udiv <32 x i8> undef, +; CHECK-NEXT: Cost Model: Found an estimated cost of 880 for instruction: %V64i8 = udiv <64 x i8> undef, +; CHECK-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret i32 undef +; + %I64 = udiv i64 undef, 7 + %V2i64 = udiv <2 x i64> undef, + %V4i64 = udiv <4 x i64> undef, + %V8i64 = udiv <8 x i64> undef, + + %I32 = udiv i32 undef, 7 + %V4i32 = udiv <4 x i32> undef, + %V8i32 = udiv <8 x i32> undef, + %V16i32 = udiv <16 x i32> undef, + + %I16 = udiv i16 undef, 7 + %V8i16 = udiv <8 x i16> undef, + %V16i16 = udiv <16 x i16> undef, + %V32i16 = udiv <32 x i16> undef, + + %I8 = udiv i8 undef, 7 + %V16i8 = udiv <16 x i8> undef, + %V32i8 = udiv <32 x i8> undef, + %V64i8 = udiv <64 x i8> undef, + + ret i32 undef +} + +define i32 @sdiv_constpow2() { +; CHECK-LABEL: 'sdiv_constpow2' +; CHECK-NEXT: Cost Model: Found an estimated cost of 5 for instruction: %I64 = sdiv i64 undef, 16 +; CHECK-NEXT: Cost Model: Found an estimated cost of 24 for instruction: %V2i64 = sdiv <2 x i64> undef, +; CHECK-NEXT: Cost Model: Found an estimated cost of 48 for instruction: %V4i64 = sdiv <4 x i64> undef, +; CHECK-NEXT: Cost Model: Found an estimated cost of 96 for instruction: %V8i64 = sdiv <8 x i64> undef, +; CHECK-NEXT: Cost Model: Found an estimated cost of 5 for instruction: %I32 = sdiv i32 undef, 16 +; CHECK-NEXT: Cost Model: Found an estimated cost of 52 for instruction: %V4i32 = sdiv <4 x i32> undef, +; CHECK-NEXT: Cost Model: Found an estimated cost of 104 for instruction: %V8i32 = sdiv <8 x i32> undef, +; CHECK-NEXT: Cost Model: Found an estimated cost of 208 for instruction: %V16i32 = sdiv <16 x i32> undef, +; CHECK-NEXT: Cost Model: Found an estimated cost of 5 for instruction: %I16 = sdiv i16 undef, 16 +; CHECK-NEXT: Cost Model: Found an estimated cost of 108 for instruction: %V8i16 = sdiv <8 x i16> undef, +; CHECK-NEXT: Cost Model: Found an estimated cost of 216 for instruction: %V16i16 = sdiv <16 x i16> undef, +; CHECK-NEXT: Cost Model: Found an estimated cost of 432 for instruction: %V32i16 = sdiv <32 x i16> undef, +; CHECK-NEXT: Cost Model: Found an estimated cost of 5 for instruction: %I8 = sdiv i8 undef, 16 +; CHECK-NEXT: Cost Model: Found an estimated cost of 220 for instruction: %V16i8 = sdiv <16 x i8> undef, +; CHECK-NEXT: Cost Model: Found an estimated cost of 440 for instruction: %V32i8 = sdiv <32 x i8> undef, +; CHECK-NEXT: Cost Model: Found an estimated cost of 880 for instruction: %V64i8 = sdiv <64 x i8> undef, +; CHECK-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret i32 undef +; + %I64 = sdiv i64 undef, 16 + %V2i64 = sdiv <2 x i64> undef, + %V4i64 = sdiv <4 x i64> undef, + %V8i64 = sdiv <8 x i64> undef, + + %I32 = sdiv i32 undef, 16 + %V4i32 = sdiv <4 x i32> undef, + %V8i32 = sdiv <8 x i32> undef, + %V16i32 = sdiv <16 x i32> undef, + + %I16 = sdiv i16 undef, 16 + %V8i16 = sdiv <8 x i16> undef, + %V16i16 = sdiv <16 x i16> undef, + %V32i16 = sdiv <32 x i16> undef, + + %I8 = sdiv i8 undef, 16 + %V16i8 = sdiv <16 x i8> undef, + %V32i8 = sdiv <32 x i8> undef, + %V64i8 = sdiv <64 x i8> undef, + + ret i32 undef +} + +define i32 @udiv_constpow2() { +; CHECK-LABEL: 'udiv_constpow2' +; CHECK-NEXT: Cost Model: Found an estimated cost of 7 for instruction: %I64 = udiv i64 undef, 16 +; CHECK-NEXT: Cost Model: Found an estimated cost of 24 for instruction: %V2i64 = udiv <2 x i64> undef, +; CHECK-NEXT: Cost Model: Found an estimated cost of 48 for instruction: %V4i64 = udiv <4 x i64> undef, +; CHECK-NEXT: Cost Model: Found an estimated cost of 96 for instruction: %V8i64 = udiv <8 x i64> undef, +; CHECK-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %I32 = udiv i32 undef, 16 +; CHECK-NEXT: Cost Model: Found an estimated cost of 52 for instruction: %V4i32 = udiv <4 x i32> undef, +; CHECK-NEXT: Cost Model: Found an estimated cost of 104 for instruction: %V8i32 = udiv <8 x i32> undef, +; CHECK-NEXT: Cost Model: Found an estimated cost of 208 for instruction: %V16i32 = udiv <16 x i32> undef, +; CHECK-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %I16 = udiv i16 undef, 16 +; CHECK-NEXT: Cost Model: Found an estimated cost of 108 for instruction: %V8i16 = udiv <8 x i16> undef, +; CHECK-NEXT: Cost Model: Found an estimated cost of 216 for instruction: %V16i16 = udiv <16 x i16> undef, +; CHECK-NEXT: Cost Model: Found an estimated cost of 432 for instruction: %V32i16 = udiv <32 x i16> undef, +; CHECK-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %I8 = udiv i8 undef, 16 +; CHECK-NEXT: Cost Model: Found an estimated cost of 220 for instruction: %V16i8 = udiv <16 x i8> undef, +; CHECK-NEXT: Cost Model: Found an estimated cost of 440 for instruction: %V32i8 = udiv <32 x i8> undef, +; CHECK-NEXT: Cost Model: Found an estimated cost of 880 for instruction: %V64i8 = udiv <64 x i8> undef, +; CHECK-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret i32 undef +; + %I64 = udiv i64 undef, 16 + %V2i64 = udiv <2 x i64> undef, + %V4i64 = udiv <4 x i64> undef, + %V8i64 = udiv <8 x i64> undef, + + %I32 = udiv i32 undef, 16 + %V4i32 = udiv <4 x i32> undef, + %V8i32 = udiv <8 x i32> undef, + %V16i32 = udiv <16 x i32> undef, + + %I16 = udiv i16 undef, 16 + %V8i16 = udiv <8 x i16> undef, + %V16i16 = udiv <16 x i16> undef, + %V32i16 = udiv <32 x i16> undef, + + %I8 = udiv i8 undef, 16 + %V16i8 = udiv <16 x i8> undef, + %V32i8 = udiv <32 x i8> undef, + %V64i8 = udiv <64 x i8> undef, + + ret i32 undef +} + +define i32 @sdiv_uniformconstpow2() { +; CHECK-LABEL: 'sdiv_uniformconstpow2' +; CHECK-NEXT: Cost Model: Found an estimated cost of 5 for instruction: %I64 = sdiv i64 undef, 16 +; CHECK-NEXT: Cost Model: Found an estimated cost of 14 for instruction: %V2i64 = sdiv <2 x i64> undef, +; CHECK-NEXT: Cost Model: Found an estimated cost of 28 for instruction: %V4i64 = sdiv <4 x i64> undef, +; CHECK-NEXT: Cost Model: Found an estimated cost of 56 for instruction: %V8i64 = sdiv <8 x i64> undef, +; CHECK-NEXT: Cost Model: Found an estimated cost of 5 for instruction: %I32 = sdiv i32 undef, 16 +; CHECK-NEXT: Cost Model: Found an estimated cost of 30 for instruction: %V4i32 = sdiv <4 x i32> undef, +; CHECK-NEXT: Cost Model: Found an estimated cost of 60 for instruction: %V8i32 = sdiv <8 x i32> undef, +; CHECK-NEXT: Cost Model: Found an estimated cost of 120 for instruction: %V16i32 = sdiv <16 x i32> undef, +; CHECK-NEXT: Cost Model: Found an estimated cost of 5 for instruction: %I16 = sdiv i16 undef, 16 +; CHECK-NEXT: Cost Model: Found an estimated cost of 62 for instruction: %V8i16 = sdiv <8 x i16> undef, +; CHECK-NEXT: Cost Model: Found an estimated cost of 124 for instruction: %V16i16 = sdiv <16 x i16> undef, +; CHECK-NEXT: Cost Model: Found an estimated cost of 248 for instruction: %V32i16 = sdiv <32 x i16> undef, +; CHECK-NEXT: Cost Model: Found an estimated cost of 5 for instruction: %I8 = sdiv i8 undef, 16 +; CHECK-NEXT: Cost Model: Found an estimated cost of 126 for instruction: %V16i8 = sdiv <16 x i8> undef, +; CHECK-NEXT: Cost Model: Found an estimated cost of 252 for instruction: %V32i8 = sdiv <32 x i8> undef, +; CHECK-NEXT: Cost Model: Found an estimated cost of 504 for instruction: %V64i8 = sdiv <64 x i8> undef, +; CHECK-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret i32 undef +; + %I64 = sdiv i64 undef, 16 + %V2i64 = sdiv <2 x i64> undef, + %V4i64 = sdiv <4 x i64> undef, + %V8i64 = sdiv <8 x i64> undef, + + %I32 = sdiv i32 undef, 16 + %V4i32 = sdiv <4 x i32> undef, + %V8i32 = sdiv <8 x i32> undef, + %V16i32 = sdiv <16 x i32> undef, + + %I16 = sdiv i16 undef, 16 + %V8i16 = sdiv <8 x i16> undef, + %V16i16 = sdiv <16 x i16> undef, + %V32i16 = sdiv <32 x i16> undef, + + %I8 = sdiv i8 undef, 16 + %V16i8 = sdiv <16 x i8> undef, + %V32i8 = sdiv <32 x i8> undef, + %V64i8 = sdiv <64 x i8> undef, + + ret i32 undef +} + +define i32 @udiv_uniformconstpow2() { +; CHECK-LABEL: 'udiv_uniformconstpow2' +; CHECK-NEXT: Cost Model: Found an estimated cost of 7 for instruction: %I64 = udiv i64 undef, 16 +; CHECK-NEXT: Cost Model: Found an estimated cost of 48 for instruction: %V2i64 = udiv <2 x i64> undef, +; CHECK-NEXT: Cost Model: Found an estimated cost of 96 for instruction: %V4i64 = udiv <4 x i64> undef, +; CHECK-NEXT: Cost Model: Found an estimated cost of 192 for instruction: %V8i64 = udiv <8 x i64> undef, +; CHECK-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %I32 = udiv i32 undef, 16 +; CHECK-NEXT: Cost Model: Found an estimated cost of 9 for instruction: %V4i32 = udiv <4 x i32> undef, +; CHECK-NEXT: Cost Model: Found an estimated cost of 104 for instruction: %V8i32 = udiv <8 x i32> undef, +; CHECK-NEXT: Cost Model: Found an estimated cost of 208 for instruction: %V16i32 = udiv <16 x i32> undef, +; CHECK-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %I16 = udiv i16 undef, 16 +; CHECK-NEXT: Cost Model: Found an estimated cost of 9 for instruction: %V8i16 = udiv <8 x i16> undef, +; CHECK-NEXT: Cost Model: Found an estimated cost of 216 for instruction: %V16i16 = udiv <16 x i16> undef, +; CHECK-NEXT: Cost Model: Found an estimated cost of 432 for instruction: %V32i16 = udiv <32 x i16> undef, +; CHECK-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %I8 = udiv i8 undef, 16 +; CHECK-NEXT: Cost Model: Found an estimated cost of 9 for instruction: %V16i8 = udiv <16 x i8> undef, +; CHECK-NEXT: Cost Model: Found an estimated cost of 440 for instruction: %V32i8 = udiv <32 x i8> undef, +; CHECK-NEXT: Cost Model: Found an estimated cost of 880 for instruction: %V64i8 = udiv <64 x i8> undef, +; CHECK-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret i32 undef +; + %I64 = udiv i64 undef, 16 + %V2i64 = udiv <2 x i64> undef, + %V4i64 = udiv <4 x i64> undef, + %V8i64 = udiv <8 x i64> undef, + + %I32 = udiv i32 undef, 16 + %V4i32 = udiv <4 x i32> undef, + %V8i32 = udiv <8 x i32> undef, + %V16i32 = udiv <16 x i32> undef, + + %I16 = udiv i16 undef, 16 + %V8i16 = udiv <8 x i16> undef, + %V16i16 = udiv <16 x i16> undef, + %V32i16 = udiv <32 x i16> undef, + + %I8 = udiv i8 undef, 16 + %V16i8 = udiv <16 x i8> undef, + %V32i8 = udiv <32 x i8> undef, + %V64i8 = udiv <64 x i8> undef, + + ret i32 undef +} + +define i32 @sdiv_constnegpow2() { +; CHECK-LABEL: 'sdiv_constnegpow2' +; CHECK-NEXT: Cost Model: Found an estimated cost of 7 for instruction: %I64 = sdiv i64 undef, -16 +; CHECK-NEXT: Cost Model: Found an estimated cost of 24 for instruction: %V2i64 = sdiv <2 x i64> undef, +; CHECK-NEXT: Cost Model: Found an estimated cost of 48 for instruction: %V4i64 = sdiv <4 x i64> undef, +; CHECK-NEXT: Cost Model: Found an estimated cost of 96 for instruction: %V8i64 = sdiv <8 x i64> undef, +; CHECK-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %I32 = sdiv i32 undef, -16 +; CHECK-NEXT: Cost Model: Found an estimated cost of 52 for instruction: %V4i32 = sdiv <4 x i32> undef, +; CHECK-NEXT: Cost Model: Found an estimated cost of 104 for instruction: %V8i32 = sdiv <8 x i32> undef, +; CHECK-NEXT: Cost Model: Found an estimated cost of 208 for instruction: %V16i32 = sdiv <16 x i32> undef, +; CHECK-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %I16 = sdiv i16 undef, -16 +; CHECK-NEXT: Cost Model: Found an estimated cost of 108 for instruction: %V8i16 = sdiv <8 x i16> undef, +; CHECK-NEXT: Cost Model: Found an estimated cost of 216 for instruction: %V16i16 = sdiv <16 x i16> undef, +; CHECK-NEXT: Cost Model: Found an estimated cost of 432 for instruction: %V32i16 = sdiv <32 x i16> undef, +; CHECK-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %I8 = sdiv i8 undef, -16 +; CHECK-NEXT: Cost Model: Found an estimated cost of 220 for instruction: %V16i8 = sdiv <16 x i8> undef, +; CHECK-NEXT: Cost Model: Found an estimated cost of 440 for instruction: %V32i8 = sdiv <32 x i8> undef, +; CHECK-NEXT: Cost Model: Found an estimated cost of 880 for instruction: %V64i8 = sdiv <64 x i8> undef, +; CHECK-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret i32 undef +; + %I64 = sdiv i64 undef, -16 + %V2i64 = sdiv <2 x i64> undef, + %V4i64 = sdiv <4 x i64> undef, + %V8i64 = sdiv <8 x i64> undef, + + %I32 = sdiv i32 undef, -16 + %V4i32 = sdiv <4 x i32> undef, + %V8i32 = sdiv <8 x i32> undef, + %V16i32 = sdiv <16 x i32> undef, + + %I16 = sdiv i16 undef, -16 + %V8i16 = sdiv <8 x i16> undef, + %V16i16 = sdiv <16 x i16> undef, + %V32i16 = sdiv <32 x i16> undef, + + %I8 = sdiv i8 undef, -16 + %V16i8 = sdiv <16 x i8> undef, + %V32i8 = sdiv <32 x i8> undef, + %V64i8 = sdiv <64 x i8> undef, + + ret i32 undef +} + +define i32 @udiv_constnegpow2() { +; CHECK-LABEL: 'udiv_constnegpow2' +; CHECK-NEXT: Cost Model: Found an estimated cost of 7 for instruction: %I64 = udiv i64 undef, -16 +; CHECK-NEXT: Cost Model: Found an estimated cost of 24 for instruction: %V2i64 = udiv <2 x i64> undef, +; CHECK-NEXT: Cost Model: Found an estimated cost of 48 for instruction: %V4i64 = udiv <4 x i64> undef, +; CHECK-NEXT: Cost Model: Found an estimated cost of 96 for instruction: %V8i64 = udiv <8 x i64> undef, +; CHECK-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %I32 = udiv i32 undef, -16 +; CHECK-NEXT: Cost Model: Found an estimated cost of 52 for instruction: %V4i32 = udiv <4 x i32> undef, +; CHECK-NEXT: Cost Model: Found an estimated cost of 104 for instruction: %V8i32 = udiv <8 x i32> undef, +; CHECK-NEXT: Cost Model: Found an estimated cost of 208 for instruction: %V16i32 = udiv <16 x i32> undef, +; CHECK-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %I16 = udiv i16 undef, -16 +; CHECK-NEXT: Cost Model: Found an estimated cost of 108 for instruction: %V8i16 = udiv <8 x i16> undef, +; CHECK-NEXT: Cost Model: Found an estimated cost of 216 for instruction: %V16i16 = udiv <16 x i16> undef, +; CHECK-NEXT: Cost Model: Found an estimated cost of 432 for instruction: %V32i16 = udiv <32 x i16> undef, +; CHECK-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %I8 = udiv i8 undef, -16 +; CHECK-NEXT: Cost Model: Found an estimated cost of 220 for instruction: %V16i8 = udiv <16 x i8> undef, +; CHECK-NEXT: Cost Model: Found an estimated cost of 440 for instruction: %V32i8 = udiv <32 x i8> undef, +; CHECK-NEXT: Cost Model: Found an estimated cost of 880 for instruction: %V64i8 = udiv <64 x i8> undef, +; CHECK-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret i32 undef +; + %I64 = udiv i64 undef, -16 + %V2i64 = udiv <2 x i64> undef, + %V4i64 = udiv <4 x i64> undef, + %V8i64 = udiv <8 x i64> undef, + + %I32 = udiv i32 undef, -16 + %V4i32 = udiv <4 x i32> undef, + %V8i32 = udiv <8 x i32> undef, + %V16i32 = udiv <16 x i32> undef, + + %I16 = udiv i16 undef, -16 + %V8i16 = udiv <8 x i16> undef, + %V16i16 = udiv <16 x i16> undef, + %V32i16 = udiv <32 x i16> undef, + + %I8 = udiv i8 undef, -16 + %V16i8 = udiv <16 x i8> undef, + %V32i8 = udiv <32 x i8> undef, + %V64i8 = udiv <64 x i8> undef, + + ret i32 undef +} + +define i32 @sdiv_uniformconstnegpow2() { +; CHECK-LABEL: 'sdiv_uniformconstnegpow2' +; CHECK-NEXT: Cost Model: Found an estimated cost of 7 for instruction: %I64 = sdiv i64 undef, -16 +; CHECK-NEXT: Cost Model: Found an estimated cost of 48 for instruction: %V2i64 = sdiv <2 x i64> undef, +; CHECK-NEXT: Cost Model: Found an estimated cost of 96 for instruction: %V4i64 = sdiv <4 x i64> undef, +; CHECK-NEXT: Cost Model: Found an estimated cost of 192 for instruction: %V8i64 = sdiv <8 x i64> undef, +; CHECK-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %I32 = sdiv i32 undef, -16 +; CHECK-NEXT: Cost Model: Found an estimated cost of 9 for instruction: %V4i32 = sdiv <4 x i32> undef, +; CHECK-NEXT: Cost Model: Found an estimated cost of 104 for instruction: %V8i32 = sdiv <8 x i32> undef, +; CHECK-NEXT: Cost Model: Found an estimated cost of 208 for instruction: %V16i32 = sdiv <16 x i32> undef, +; CHECK-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %I16 = sdiv i16 undef, -16 +; CHECK-NEXT: Cost Model: Found an estimated cost of 9 for instruction: %V8i16 = sdiv <8 x i16> undef, +; CHECK-NEXT: Cost Model: Found an estimated cost of 216 for instruction: %V16i16 = sdiv <16 x i16> undef, +; CHECK-NEXT: Cost Model: Found an estimated cost of 432 for instruction: %V32i16 = sdiv <32 x i16> undef, +; CHECK-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %I8 = sdiv i8 undef, -16 +; CHECK-NEXT: Cost Model: Found an estimated cost of 9 for instruction: %V16i8 = sdiv <16 x i8> undef, +; CHECK-NEXT: Cost Model: Found an estimated cost of 440 for instruction: %V32i8 = sdiv <32 x i8> undef, +; CHECK-NEXT: Cost Model: Found an estimated cost of 880 for instruction: %V64i8 = sdiv <64 x i8> undef, +; CHECK-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret i32 undef +; + %I64 = sdiv i64 undef, -16 + %V2i64 = sdiv <2 x i64> undef, + %V4i64 = sdiv <4 x i64> undef, + %V8i64 = sdiv <8 x i64> undef, + + %I32 = sdiv i32 undef, -16 + %V4i32 = sdiv <4 x i32> undef, + %V8i32 = sdiv <8 x i32> undef, + %V16i32 = sdiv <16 x i32> undef, + + %I16 = sdiv i16 undef, -16 + %V8i16 = sdiv <8 x i16> undef, + %V16i16 = sdiv <16 x i16> undef, + %V32i16 = sdiv <32 x i16> undef, + + %I8 = sdiv i8 undef, -16 + %V16i8 = sdiv <16 x i8> undef, + %V32i8 = sdiv <32 x i8> undef, + %V64i8 = sdiv <64 x i8> undef, + + ret i32 undef +} + +define i32 @udiv_uniformconstnegpow2() { +; CHECK-LABEL: 'udiv_uniformconstnegpow2' +; CHECK-NEXT: Cost Model: Found an estimated cost of 7 for instruction: %I64 = udiv i64 undef, -16 +; CHECK-NEXT: Cost Model: Found an estimated cost of 48 for instruction: %V2i64 = udiv <2 x i64> undef, +; CHECK-NEXT: Cost Model: Found an estimated cost of 96 for instruction: %V4i64 = udiv <4 x i64> undef, +; CHECK-NEXT: Cost Model: Found an estimated cost of 192 for instruction: %V8i64 = udiv <8 x i64> undef, +; CHECK-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %I32 = udiv i32 undef, -16 +; CHECK-NEXT: Cost Model: Found an estimated cost of 9 for instruction: %V4i32 = udiv <4 x i32> undef, +; CHECK-NEXT: Cost Model: Found an estimated cost of 104 for instruction: %V8i32 = udiv <8 x i32> undef, +; CHECK-NEXT: Cost Model: Found an estimated cost of 208 for instruction: %V16i32 = udiv <16 x i32> undef, +; CHECK-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %I16 = udiv i16 undef, -16 +; CHECK-NEXT: Cost Model: Found an estimated cost of 9 for instruction: %V8i16 = udiv <8 x i16> undef, +; CHECK-NEXT: Cost Model: Found an estimated cost of 216 for instruction: %V16i16 = udiv <16 x i16> undef, +; CHECK-NEXT: Cost Model: Found an estimated cost of 432 for instruction: %V32i16 = udiv <32 x i16> undef, +; CHECK-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %I8 = udiv i8 undef, -16 +; CHECK-NEXT: Cost Model: Found an estimated cost of 9 for instruction: %V16i8 = udiv <16 x i8> undef, +; CHECK-NEXT: Cost Model: Found an estimated cost of 440 for instruction: %V32i8 = udiv <32 x i8> undef, +; CHECK-NEXT: Cost Model: Found an estimated cost of 880 for instruction: %V64i8 = udiv <64 x i8> undef, +; CHECK-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret i32 undef +; + %I64 = udiv i64 undef, -16 + %V2i64 = udiv <2 x i64> undef, + %V4i64 = udiv <4 x i64> undef, + %V8i64 = udiv <8 x i64> undef, + + %I32 = udiv i32 undef, -16 + %V4i32 = udiv <4 x i32> undef, + %V8i32 = udiv <8 x i32> undef, + %V16i32 = udiv <16 x i32> undef, + + %I16 = udiv i16 undef, -16 + %V8i16 = udiv <8 x i16> undef, + %V16i16 = udiv <16 x i16> undef, + %V32i16 = udiv <32 x i16> undef, + + %I8 = udiv i8 undef, -16 + %V16i8 = udiv <16 x i8> undef, + %V32i8 = udiv <32 x i8> undef, + %V64i8 = udiv <64 x i8> undef, + + ret i32 undef } diff --git a/llvm/test/Analysis/CostModel/AArch64/rem.ll b/llvm/test/Analysis/CostModel/AArch64/rem.ll new file mode 100644 index 000000000000..cc5030e3823a --- /dev/null +++ b/llvm/test/Analysis/CostModel/AArch64/rem.ll @@ -0,0 +1,604 @@ +; NOTE: Assertions have been autogenerated by utils/update_analyze_test_checks.py +; RUN: opt < %s -mtriple=aarch64-unknown-linux-gnu -cost-model -analyze | FileCheck %s + +define i32 @srem() { +; CHECK-LABEL: 'srem' +; CHECK-NEXT: Cost Model: Found an estimated cost of 3 for instruction: %I64 = srem i64 undef, undef +; CHECK-NEXT: Cost Model: Found an estimated cost of 12 for instruction: %V2i64 = srem <2 x i64> undef, undef +; CHECK-NEXT: Cost Model: Found an estimated cost of 24 for instruction: %V4i64 = srem <4 x i64> undef, undef +; CHECK-NEXT: Cost Model: Found an estimated cost of 48 for instruction: %V8i64 = srem <8 x i64> undef, undef +; CHECK-NEXT: Cost Model: Found an estimated cost of 3 for instruction: %I32 = srem i32 undef, undef +; CHECK-NEXT: Cost Model: Found an estimated cost of 30 for instruction: %V4i32 = srem <4 x i32> undef, undef +; CHECK-NEXT: Cost Model: Found an estimated cost of 60 for instruction: %V8i32 = srem <8 x i32> undef, undef +; CHECK-NEXT: Cost Model: Found an estimated cost of 120 for instruction: %V16i32 = srem <16 x i32> undef, undef +; CHECK-NEXT: Cost Model: Found an estimated cost of 3 for instruction: %I16 = srem i16 undef, undef +; CHECK-NEXT: Cost Model: Found an estimated cost of 66 for instruction: %V8i16 = srem <8 x i16> undef, undef +; CHECK-NEXT: Cost Model: Found an estimated cost of 132 for instruction: %V16i16 = srem <16 x i16> undef, undef +; CHECK-NEXT: Cost Model: Found an estimated cost of 264 for instruction: %V32i16 = srem <32 x i16> undef, undef +; CHECK-NEXT: Cost Model: Found an estimated cost of 3 for instruction: %I8 = srem i8 undef, undef +; CHECK-NEXT: Cost Model: Found an estimated cost of 138 for instruction: %V16i8 = srem <16 x i8> undef, undef +; CHECK-NEXT: Cost Model: Found an estimated cost of 276 for instruction: %V32i8 = srem <32 x i8> undef, undef +; CHECK-NEXT: Cost Model: Found an estimated cost of 552 for instruction: %V64i8 = srem <64 x i8> undef, undef +; CHECK-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret i32 undef +; + %I64 = srem i64 undef, undef + %V2i64 = srem <2 x i64> undef, undef + %V4i64 = srem <4 x i64> undef, undef + %V8i64 = srem <8 x i64> undef, undef + + %I32 = srem i32 undef, undef + %V4i32 = srem <4 x i32> undef, undef + %V8i32 = srem <8 x i32> undef, undef + %V16i32 = srem <16 x i32> undef, undef + + %I16 = srem i16 undef, undef + %V8i16 = srem <8 x i16> undef, undef + %V16i16 = srem <16 x i16> undef, undef + %V32i16 = srem <32 x i16> undef, undef + + %I8 = srem i8 undef, undef + %V16i8 = srem <16 x i8> undef, undef + %V32i8 = srem <32 x i8> undef, undef + %V64i8 = srem <64 x i8> undef, undef + + ret i32 undef +} + +define i32 @urem() { +; CHECK-LABEL: 'urem' +; CHECK-NEXT: Cost Model: Found an estimated cost of 3 for instruction: %I64 = urem i64 undef, undef +; CHECK-NEXT: Cost Model: Found an estimated cost of 12 for instruction: %V2i64 = urem <2 x i64> undef, undef +; CHECK-NEXT: Cost Model: Found an estimated cost of 24 for instruction: %V4i64 = urem <4 x i64> undef, undef +; CHECK-NEXT: Cost Model: Found an estimated cost of 48 for instruction: %V8i64 = urem <8 x i64> undef, undef +; CHECK-NEXT: Cost Model: Found an estimated cost of 3 for instruction: %I32 = urem i32 undef, undef +; CHECK-NEXT: Cost Model: Found an estimated cost of 30 for instruction: %V4i32 = urem <4 x i32> undef, undef +; CHECK-NEXT: Cost Model: Found an estimated cost of 60 for instruction: %V8i32 = urem <8 x i32> undef, undef +; CHECK-NEXT: Cost Model: Found an estimated cost of 120 for instruction: %V16i32 = urem <16 x i32> undef, undef +; CHECK-NEXT: Cost Model: Found an estimated cost of 3 for instruction: %I16 = urem i16 undef, undef +; CHECK-NEXT: Cost Model: Found an estimated cost of 66 for instruction: %V8i16 = urem <8 x i16> undef, undef +; CHECK-NEXT: Cost Model: Found an estimated cost of 132 for instruction: %V16i16 = urem <16 x i16> undef, undef +; CHECK-NEXT: Cost Model: Found an estimated cost of 264 for instruction: %V32i16 = urem <32 x i16> undef, undef +; CHECK-NEXT: Cost Model: Found an estimated cost of 3 for instruction: %I8 = urem i8 undef, undef +; CHECK-NEXT: Cost Model: Found an estimated cost of 138 for instruction: %V16i8 = urem <16 x i8> undef, undef +; CHECK-NEXT: Cost Model: Found an estimated cost of 276 for instruction: %V32i8 = urem <32 x i8> undef, undef +; CHECK-NEXT: Cost Model: Found an estimated cost of 552 for instruction: %V64i8 = urem <64 x i8> undef, undef +; CHECK-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret i32 undef +; + %I64 = urem i64 undef, undef + %V2i64 = urem <2 x i64> undef, undef + %V4i64 = urem <4 x i64> undef, undef + %V8i64 = urem <8 x i64> undef, undef + + %I32 = urem i32 undef, undef + %V4i32 = urem <4 x i32> undef, undef + %V8i32 = urem <8 x i32> undef, undef + %V16i32 = urem <16 x i32> undef, undef + + %I16 = urem i16 undef, undef + %V8i16 = urem <8 x i16> undef, undef + %V16i16 = urem <16 x i16> undef, undef + %V32i16 = urem <32 x i16> undef, undef + + %I8 = urem i8 undef, undef + %V16i8 = urem <16 x i8> undef, undef + %V32i8 = urem <32 x i8> undef, undef + %V64i8 = urem <64 x i8> undef, undef + + ret i32 undef +} + +define i32 @srem_const() { +; CHECK-LABEL: 'srem_const' +; CHECK-NEXT: Cost Model: Found an estimated cost of 9 for instruction: %I64 = srem i64 undef, 7 +; CHECK-NEXT: Cost Model: Found an estimated cost of 12 for instruction: %V2i64 = srem <2 x i64> undef, +; CHECK-NEXT: Cost Model: Found an estimated cost of 24 for instruction: %V4i64 = srem <4 x i64> undef, +; CHECK-NEXT: Cost Model: Found an estimated cost of 48 for instruction: %V8i64 = srem <8 x i64> undef, +; CHECK-NEXT: Cost Model: Found an estimated cost of 3 for instruction: %I32 = srem i32 undef, 7 +; CHECK-NEXT: Cost Model: Found an estimated cost of 30 for instruction: %V4i32 = srem <4 x i32> undef, +; CHECK-NEXT: Cost Model: Found an estimated cost of 60 for instruction: %V8i32 = srem <8 x i32> undef, +; CHECK-NEXT: Cost Model: Found an estimated cost of 120 for instruction: %V16i32 = srem <16 x i32> undef, +; CHECK-NEXT: Cost Model: Found an estimated cost of 3 for instruction: %I16 = srem i16 undef, 7 +; CHECK-NEXT: Cost Model: Found an estimated cost of 66 for instruction: %V8i16 = srem <8 x i16> undef, +; CHECK-NEXT: Cost Model: Found an estimated cost of 132 for instruction: %V16i16 = srem <16 x i16> undef, +; CHECK-NEXT: Cost Model: Found an estimated cost of 264 for instruction: %V32i16 = srem <32 x i16> undef, +; CHECK-NEXT: Cost Model: Found an estimated cost of 3 for instruction: %I8 = srem i8 undef, 7 +; CHECK-NEXT: Cost Model: Found an estimated cost of 138 for instruction: %V16i8 = srem <16 x i8> undef, +; CHECK-NEXT: Cost Model: Found an estimated cost of 276 for instruction: %V32i8 = srem <32 x i8> undef, +; CHECK-NEXT: Cost Model: Found an estimated cost of 552 for instruction: %V64i8 = srem <64 x i8> undef, +; CHECK-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret i32 undef +; + %I64 = srem i64 undef, 7 + %V2i64 = srem <2 x i64> undef, + %V4i64 = srem <4 x i64> undef, + %V8i64 = srem <8 x i64> undef, + + %I32 = srem i32 undef, 7 + %V4i32 = srem <4 x i32> undef, + %V8i32 = srem <8 x i32> undef, + %V16i32 = srem <16 x i32> undef, + + %I16 = srem i16 undef, 7 + %V8i16 = srem <8 x i16> undef, + %V16i16 = srem <16 x i16> undef, + %V32i16 = srem <32 x i16> undef, + + %I8 = srem i8 undef, 7 + %V16i8 = srem <16 x i8> undef, + %V32i8 = srem <32 x i8> undef, + %V64i8 = srem <64 x i8> undef, + + ret i32 undef +} + +define i32 @urem_const() { +; CHECK-LABEL: 'urem_const' +; CHECK-NEXT: Cost Model: Found an estimated cost of 9 for instruction: %I64 = urem i64 undef, 7 +; CHECK-NEXT: Cost Model: Found an estimated cost of 12 for instruction: %V2i64 = urem <2 x i64> undef, +; CHECK-NEXT: Cost Model: Found an estimated cost of 24 for instruction: %V4i64 = urem <4 x i64> undef, +; CHECK-NEXT: Cost Model: Found an estimated cost of 48 for instruction: %V8i64 = urem <8 x i64> undef, +; CHECK-NEXT: Cost Model: Found an estimated cost of 3 for instruction: %I32 = urem i32 undef, 7 +; CHECK-NEXT: Cost Model: Found an estimated cost of 30 for instruction: %V4i32 = urem <4 x i32> undef, +; CHECK-NEXT: Cost Model: Found an estimated cost of 60 for instruction: %V8i32 = urem <8 x i32> undef, +; CHECK-NEXT: Cost Model: Found an estimated cost of 120 for instruction: %V16i32 = urem <16 x i32> undef, +; CHECK-NEXT: Cost Model: Found an estimated cost of 3 for instruction: %I16 = urem i16 undef, 7 +; CHECK-NEXT: Cost Model: Found an estimated cost of 66 for instruction: %V8i16 = urem <8 x i16> undef, +; CHECK-NEXT: Cost Model: Found an estimated cost of 132 for instruction: %V16i16 = urem <16 x i16> undef, +; CHECK-NEXT: Cost Model: Found an estimated cost of 264 for instruction: %V32i16 = urem <32 x i16> undef, +; CHECK-NEXT: Cost Model: Found an estimated cost of 3 for instruction: %I8 = urem i8 undef, 7 +; CHECK-NEXT: Cost Model: Found an estimated cost of 138 for instruction: %V16i8 = urem <16 x i8> undef, +; CHECK-NEXT: Cost Model: Found an estimated cost of 276 for instruction: %V32i8 = urem <32 x i8> undef, +; CHECK-NEXT: Cost Model: Found an estimated cost of 552 for instruction: %V64i8 = urem <64 x i8> undef, +; CHECK-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret i32 undef +; + %I64 = urem i64 undef, 7 + %V2i64 = urem <2 x i64> undef, + %V4i64 = urem <4 x i64> undef, + %V8i64 = urem <8 x i64> undef, + + %I32 = urem i32 undef, 7 + %V4i32 = urem <4 x i32> undef, + %V8i32 = urem <8 x i32> undef, + %V16i32 = urem <16 x i32> undef, + + %I16 = urem i16 undef, 7 + %V8i16 = urem <8 x i16> undef, + %V16i16 = urem <16 x i16> undef, + %V32i16 = urem <32 x i16> undef, + + %I8 = urem i8 undef, 7 + %V16i8 = urem <16 x i8> undef, + %V32i8 = urem <32 x i8> undef, + %V64i8 = urem <64 x i8> undef, + + ret i32 undef +} + +define i32 @srem_uniformconst() { +; CHECK-LABEL: 'srem_uniformconst' +; CHECK-NEXT: Cost Model: Found an estimated cost of 9 for instruction: %I64 = srem i64 undef, 7 +; CHECK-NEXT: Cost Model: Found an estimated cost of 24 for instruction: %V2i64 = srem <2 x i64> undef, +; CHECK-NEXT: Cost Model: Found an estimated cost of 48 for instruction: %V4i64 = srem <4 x i64> undef, +; CHECK-NEXT: Cost Model: Found an estimated cost of 96 for instruction: %V8i64 = srem <8 x i64> undef, +; CHECK-NEXT: Cost Model: Found an estimated cost of 3 for instruction: %I32 = srem i32 undef, 7 +; CHECK-NEXT: Cost Model: Found an estimated cost of 30 for instruction: %V4i32 = srem <4 x i32> undef, +; CHECK-NEXT: Cost Model: Found an estimated cost of 60 for instruction: %V8i32 = srem <8 x i32> undef, +; CHECK-NEXT: Cost Model: Found an estimated cost of 120 for instruction: %V16i32 = srem <16 x i32> undef, +; CHECK-NEXT: Cost Model: Found an estimated cost of 3 for instruction: %I16 = srem i16 undef, 7 +; CHECK-NEXT: Cost Model: Found an estimated cost of 66 for instruction: %V8i16 = srem <8 x i16> undef, +; CHECK-NEXT: Cost Model: Found an estimated cost of 132 for instruction: %V16i16 = srem <16 x i16> undef, +; CHECK-NEXT: Cost Model: Found an estimated cost of 264 for instruction: %V32i16 = srem <32 x i16> undef, +; CHECK-NEXT: Cost Model: Found an estimated cost of 3 for instruction: %I8 = srem i8 undef, 7 +; CHECK-NEXT: Cost Model: Found an estimated cost of 138 for instruction: %V16i8 = srem <16 x i8> undef, +; CHECK-NEXT: Cost Model: Found an estimated cost of 276 for instruction: %V32i8 = srem <32 x i8> undef, +; CHECK-NEXT: Cost Model: Found an estimated cost of 552 for instruction: %V64i8 = srem <64 x i8> undef, +; CHECK-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret i32 undef +; + %I64 = srem i64 undef, 7 + %V2i64 = srem <2 x i64> undef, + %V4i64 = srem <4 x i64> undef, + %V8i64 = srem <8 x i64> undef, + + %I32 = srem i32 undef, 7 + %V4i32 = srem <4 x i32> undef, + %V8i32 = srem <8 x i32> undef, + %V16i32 = srem <16 x i32> undef, + + %I16 = srem i16 undef, 7 + %V8i16 = srem <8 x i16> undef, + %V16i16 = srem <16 x i16> undef, + %V32i16 = srem <32 x i16> undef, + + %I8 = srem i8 undef, 7 + %V16i8 = srem <16 x i8> undef, + %V32i8 = srem <32 x i8> undef, + %V64i8 = srem <64 x i8> undef, + + ret i32 undef +} + +define i32 @urem_uniformconst() { +; CHECK-LABEL: 'urem_uniformconst' +; CHECK-NEXT: Cost Model: Found an estimated cost of 9 for instruction: %I64 = urem i64 undef, 7 +; CHECK-NEXT: Cost Model: Found an estimated cost of 24 for instruction: %V2i64 = urem <2 x i64> undef, +; CHECK-NEXT: Cost Model: Found an estimated cost of 48 for instruction: %V4i64 = urem <4 x i64> undef, +; CHECK-NEXT: Cost Model: Found an estimated cost of 96 for instruction: %V8i64 = urem <8 x i64> undef, +; CHECK-NEXT: Cost Model: Found an estimated cost of 3 for instruction: %I32 = urem i32 undef, 7 +; CHECK-NEXT: Cost Model: Found an estimated cost of 30 for instruction: %V4i32 = urem <4 x i32> undef, +; CHECK-NEXT: Cost Model: Found an estimated cost of 60 for instruction: %V8i32 = urem <8 x i32> undef, +; CHECK-NEXT: Cost Model: Found an estimated cost of 120 for instruction: %V16i32 = urem <16 x i32> undef, +; CHECK-NEXT: Cost Model: Found an estimated cost of 3 for instruction: %I16 = urem i16 undef, 7 +; CHECK-NEXT: Cost Model: Found an estimated cost of 66 for instruction: %V8i16 = urem <8 x i16> undef, +; CHECK-NEXT: Cost Model: Found an estimated cost of 132 for instruction: %V16i16 = urem <16 x i16> undef, +; CHECK-NEXT: Cost Model: Found an estimated cost of 264 for instruction: %V32i16 = urem <32 x i16> undef, +; CHECK-NEXT: Cost Model: Found an estimated cost of 3 for instruction: %I8 = urem i8 undef, 7 +; CHECK-NEXT: Cost Model: Found an estimated cost of 138 for instruction: %V16i8 = urem <16 x i8> undef, +; CHECK-NEXT: Cost Model: Found an estimated cost of 276 for instruction: %V32i8 = urem <32 x i8> undef, +; CHECK-NEXT: Cost Model: Found an estimated cost of 552 for instruction: %V64i8 = urem <64 x i8> undef, +; CHECK-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret i32 undef +; + %I64 = urem i64 undef, 7 + %V2i64 = urem <2 x i64> undef, + %V4i64 = urem <4 x i64> undef, + %V8i64 = urem <8 x i64> undef, + + %I32 = urem i32 undef, 7 + %V4i32 = urem <4 x i32> undef, + %V8i32 = urem <8 x i32> undef, + %V16i32 = urem <16 x i32> undef, + + %I16 = urem i16 undef, 7 + %V8i16 = urem <8 x i16> undef, + %V16i16 = urem <16 x i16> undef, + %V32i16 = urem <32 x i16> undef, + + %I8 = urem i8 undef, 7 + %V16i8 = urem <16 x i8> undef, + %V32i8 = urem <32 x i8> undef, + %V64i8 = urem <64 x i8> undef, + + ret i32 undef +} + +define i32 @srem_constpow2() { +; CHECK-LABEL: 'srem_constpow2' +; CHECK-NEXT: Cost Model: Found an estimated cost of 7 for instruction: %I64 = srem i64 undef, 16 +; CHECK-NEXT: Cost Model: Found an estimated cost of 12 for instruction: %V2i64 = srem <2 x i64> undef, +; CHECK-NEXT: Cost Model: Found an estimated cost of 24 for instruction: %V4i64 = srem <4 x i64> undef, +; CHECK-NEXT: Cost Model: Found an estimated cost of 48 for instruction: %V8i64 = srem <8 x i64> undef, +; CHECK-NEXT: Cost Model: Found an estimated cost of 7 for instruction: %I32 = srem i32 undef, 16 +; CHECK-NEXT: Cost Model: Found an estimated cost of 30 for instruction: %V4i32 = srem <4 x i32> undef, +; CHECK-NEXT: Cost Model: Found an estimated cost of 60 for instruction: %V8i32 = srem <8 x i32> undef, +; CHECK-NEXT: Cost Model: Found an estimated cost of 120 for instruction: %V16i32 = srem <16 x i32> undef, +; CHECK-NEXT: Cost Model: Found an estimated cost of 7 for instruction: %I16 = srem i16 undef, 16 +; CHECK-NEXT: Cost Model: Found an estimated cost of 66 for instruction: %V8i16 = srem <8 x i16> undef, +; CHECK-NEXT: Cost Model: Found an estimated cost of 132 for instruction: %V16i16 = srem <16 x i16> undef, +; CHECK-NEXT: Cost Model: Found an estimated cost of 264 for instruction: %V32i16 = srem <32 x i16> undef, +; CHECK-NEXT: Cost Model: Found an estimated cost of 7 for instruction: %I8 = srem i8 undef, 16 +; CHECK-NEXT: Cost Model: Found an estimated cost of 138 for instruction: %V16i8 = srem <16 x i8> undef, +; CHECK-NEXT: Cost Model: Found an estimated cost of 276 for instruction: %V32i8 = srem <32 x i8> undef, +; CHECK-NEXT: Cost Model: Found an estimated cost of 552 for instruction: %V64i8 = srem <64 x i8> undef, +; CHECK-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret i32 undef +; + %I64 = srem i64 undef, 16 + %V2i64 = srem <2 x i64> undef, + %V4i64 = srem <4 x i64> undef, + %V8i64 = srem <8 x i64> undef, + + %I32 = srem i32 undef, 16 + %V4i32 = srem <4 x i32> undef, + %V8i32 = srem <8 x i32> undef, + %V16i32 = srem <16 x i32> undef, + + %I16 = srem i16 undef, 16 + %V8i16 = srem <8 x i16> undef, + %V16i16 = srem <16 x i16> undef, + %V32i16 = srem <32 x i16> undef, + + %I8 = srem i8 undef, 16 + %V16i8 = srem <16 x i8> undef, + %V32i8 = srem <32 x i8> undef, + %V64i8 = srem <64 x i8> undef, + + ret i32 undef +} + +define i32 @urem_constpow2() { +; CHECK-LABEL: 'urem_constpow2' +; CHECK-NEXT: Cost Model: Found an estimated cost of 9 for instruction: %I64 = urem i64 undef, 16 +; CHECK-NEXT: Cost Model: Found an estimated cost of 12 for instruction: %V2i64 = urem <2 x i64> undef, +; CHECK-NEXT: Cost Model: Found an estimated cost of 24 for instruction: %V4i64 = urem <4 x i64> undef, +; CHECK-NEXT: Cost Model: Found an estimated cost of 48 for instruction: %V8i64 = urem <8 x i64> undef, +; CHECK-NEXT: Cost Model: Found an estimated cost of 3 for instruction: %I32 = urem i32 undef, 16 +; CHECK-NEXT: Cost Model: Found an estimated cost of 30 for instruction: %V4i32 = urem <4 x i32> undef, +; CHECK-NEXT: Cost Model: Found an estimated cost of 60 for instruction: %V8i32 = urem <8 x i32> undef, +; CHECK-NEXT: Cost Model: Found an estimated cost of 120 for instruction: %V16i32 = urem <16 x i32> undef, +; CHECK-NEXT: Cost Model: Found an estimated cost of 3 for instruction: %I16 = urem i16 undef, 16 +; CHECK-NEXT: Cost Model: Found an estimated cost of 66 for instruction: %V8i16 = urem <8 x i16> undef, +; CHECK-NEXT: Cost Model: Found an estimated cost of 132 for instruction: %V16i16 = urem <16 x i16> undef, +; CHECK-NEXT: Cost Model: Found an estimated cost of 264 for instruction: %V32i16 = urem <32 x i16> undef, +; CHECK-NEXT: Cost Model: Found an estimated cost of 3 for instruction: %I8 = urem i8 undef, 16 +; CHECK-NEXT: Cost Model: Found an estimated cost of 138 for instruction: %V16i8 = urem <16 x i8> undef, +; CHECK-NEXT: Cost Model: Found an estimated cost of 276 for instruction: %V32i8 = urem <32 x i8> undef, +; CHECK-NEXT: Cost Model: Found an estimated cost of 552 for instruction: %V64i8 = urem <64 x i8> undef, +; CHECK-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret i32 undef +; + %I64 = urem i64 undef, 16 + %V2i64 = urem <2 x i64> undef, + %V4i64 = urem <4 x i64> undef, + %V8i64 = urem <8 x i64> undef, + + %I32 = urem i32 undef, 16 + %V4i32 = urem <4 x i32> undef, + %V8i32 = urem <8 x i32> undef, + %V16i32 = urem <16 x i32> undef, + + %I16 = urem i16 undef, 16 + %V8i16 = urem <8 x i16> undef, + %V16i16 = urem <16 x i16> undef, + %V32i16 = urem <32 x i16> undef, + + %I8 = urem i8 undef, 16 + %V16i8 = urem <16 x i8> undef, + %V32i8 = urem <32 x i8> undef, + %V64i8 = urem <64 x i8> undef, + + ret i32 undef +} + +define i32 @srem_uniformconstpow2() { +; CHECK-LABEL: 'srem_uniformconstpow2' +; CHECK-NEXT: Cost Model: Found an estimated cost of 7 for instruction: %I64 = srem i64 undef, 16 +; CHECK-NEXT: Cost Model: Found an estimated cost of 20 for instruction: %V2i64 = srem <2 x i64> undef, +; CHECK-NEXT: Cost Model: Found an estimated cost of 40 for instruction: %V4i64 = srem <4 x i64> undef, +; CHECK-NEXT: Cost Model: Found an estimated cost of 80 for instruction: %V8i64 = srem <8 x i64> undef, +; CHECK-NEXT: Cost Model: Found an estimated cost of 7 for instruction: %I32 = srem i32 undef, 16 +; CHECK-NEXT: Cost Model: Found an estimated cost of 46 for instruction: %V4i32 = srem <4 x i32> undef, +; CHECK-NEXT: Cost Model: Found an estimated cost of 92 for instruction: %V8i32 = srem <8 x i32> undef, +; CHECK-NEXT: Cost Model: Found an estimated cost of 184 for instruction: %V16i32 = srem <16 x i32> undef, +; CHECK-NEXT: Cost Model: Found an estimated cost of 7 for instruction: %I16 = srem i16 undef, 16 +; CHECK-NEXT: Cost Model: Found an estimated cost of 98 for instruction: %V8i16 = srem <8 x i16> undef, +; CHECK-NEXT: Cost Model: Found an estimated cost of 196 for instruction: %V16i16 = srem <16 x i16> undef, +; CHECK-NEXT: Cost Model: Found an estimated cost of 392 for instruction: %V32i16 = srem <32 x i16> undef, +; CHECK-NEXT: Cost Model: Found an estimated cost of 7 for instruction: %I8 = srem i8 undef, 16 +; CHECK-NEXT: Cost Model: Found an estimated cost of 202 for instruction: %V16i8 = srem <16 x i8> undef, +; CHECK-NEXT: Cost Model: Found an estimated cost of 404 for instruction: %V32i8 = srem <32 x i8> undef, +; CHECK-NEXT: Cost Model: Found an estimated cost of 808 for instruction: %V64i8 = srem <64 x i8> undef, +; CHECK-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret i32 undef +; + %I64 = srem i64 undef, 16 + %V2i64 = srem <2 x i64> undef, + %V4i64 = srem <4 x i64> undef, + %V8i64 = srem <8 x i64> undef, + + %I32 = srem i32 undef, 16 + %V4i32 = srem <4 x i32> undef, + %V8i32 = srem <8 x i32> undef, + %V16i32 = srem <16 x i32> undef, + + %I16 = srem i16 undef, 16 + %V8i16 = srem <8 x i16> undef, + %V16i16 = srem <16 x i16> undef, + %V32i16 = srem <32 x i16> undef, + + %I8 = srem i8 undef, 16 + %V16i8 = srem <16 x i8> undef, + %V32i8 = srem <32 x i8> undef, + %V64i8 = srem <64 x i8> undef, + + ret i32 undef +} + +define i32 @urem_uniformconstpow2() { +; CHECK-LABEL: 'urem_uniformconstpow2' +; CHECK-NEXT: Cost Model: Found an estimated cost of 9 for instruction: %I64 = urem i64 undef, 16 +; CHECK-NEXT: Cost Model: Found an estimated cost of 24 for instruction: %V2i64 = urem <2 x i64> undef, +; CHECK-NEXT: Cost Model: Found an estimated cost of 48 for instruction: %V4i64 = urem <4 x i64> undef, +; CHECK-NEXT: Cost Model: Found an estimated cost of 96 for instruction: %V8i64 = urem <8 x i64> undef, +; CHECK-NEXT: Cost Model: Found an estimated cost of 3 for instruction: %I32 = urem i32 undef, 16 +; CHECK-NEXT: Cost Model: Found an estimated cost of 30 for instruction: %V4i32 = urem <4 x i32> undef, +; CHECK-NEXT: Cost Model: Found an estimated cost of 60 for instruction: %V8i32 = urem <8 x i32> undef, +; CHECK-NEXT: Cost Model: Found an estimated cost of 120 for instruction: %V16i32 = urem <16 x i32> undef, +; CHECK-NEXT: Cost Model: Found an estimated cost of 3 for instruction: %I16 = urem i16 undef, 16 +; CHECK-NEXT: Cost Model: Found an estimated cost of 66 for instruction: %V8i16 = urem <8 x i16> undef, +; CHECK-NEXT: Cost Model: Found an estimated cost of 132 for instruction: %V16i16 = urem <16 x i16> undef, +; CHECK-NEXT: Cost Model: Found an estimated cost of 264 for instruction: %V32i16 = urem <32 x i16> undef, +; CHECK-NEXT: Cost Model: Found an estimated cost of 3 for instruction: %I8 = urem i8 undef, 16 +; CHECK-NEXT: Cost Model: Found an estimated cost of 138 for instruction: %V16i8 = urem <16 x i8> undef, +; CHECK-NEXT: Cost Model: Found an estimated cost of 276 for instruction: %V32i8 = urem <32 x i8> undef, +; CHECK-NEXT: Cost Model: Found an estimated cost of 552 for instruction: %V64i8 = urem <64 x i8> undef, +; CHECK-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret i32 undef +; + %I64 = urem i64 undef, 16 + %V2i64 = urem <2 x i64> undef, + %V4i64 = urem <4 x i64> undef, + %V8i64 = urem <8 x i64> undef, + + %I32 = urem i32 undef, 16 + %V4i32 = urem <4 x i32> undef, + %V8i32 = urem <8 x i32> undef, + %V16i32 = urem <16 x i32> undef, + + %I16 = urem i16 undef, 16 + %V8i16 = urem <8 x i16> undef, + %V16i16 = urem <16 x i16> undef, + %V32i16 = urem <32 x i16> undef, + + %I8 = urem i8 undef, 16 + %V16i8 = urem <16 x i8> undef, + %V32i8 = urem <32 x i8> undef, + %V64i8 = urem <64 x i8> undef, + + ret i32 undef +} + +define i32 @srem_constnegpow2() { +; CHECK-LABEL: 'srem_constnegpow2' +; CHECK-NEXT: Cost Model: Found an estimated cost of 9 for instruction: %I64 = srem i64 undef, -16 +; CHECK-NEXT: Cost Model: Found an estimated cost of 12 for instruction: %V2i64 = srem <2 x i64> undef, +; CHECK-NEXT: Cost Model: Found an estimated cost of 24 for instruction: %V4i64 = srem <4 x i64> undef, +; CHECK-NEXT: Cost Model: Found an estimated cost of 48 for instruction: %V8i64 = srem <8 x i64> undef, +; CHECK-NEXT: Cost Model: Found an estimated cost of 3 for instruction: %I32 = srem i32 undef, -16 +; CHECK-NEXT: Cost Model: Found an estimated cost of 30 for instruction: %V4i32 = srem <4 x i32> undef, +; CHECK-NEXT: Cost Model: Found an estimated cost of 60 for instruction: %V8i32 = srem <8 x i32> undef, +; CHECK-NEXT: Cost Model: Found an estimated cost of 120 for instruction: %V16i32 = srem <16 x i32> undef, +; CHECK-NEXT: Cost Model: Found an estimated cost of 3 for instruction: %I16 = srem i16 undef, -16 +; CHECK-NEXT: Cost Model: Found an estimated cost of 66 for instruction: %V8i16 = srem <8 x i16> undef, +; CHECK-NEXT: Cost Model: Found an estimated cost of 132 for instruction: %V16i16 = srem <16 x i16> undef, +; CHECK-NEXT: Cost Model: Found an estimated cost of 264 for instruction: %V32i16 = srem <32 x i16> undef, +; CHECK-NEXT: Cost Model: Found an estimated cost of 3 for instruction: %I8 = srem i8 undef, -16 +; CHECK-NEXT: Cost Model: Found an estimated cost of 138 for instruction: %V16i8 = srem <16 x i8> undef, +; CHECK-NEXT: Cost Model: Found an estimated cost of 276 for instruction: %V32i8 = srem <32 x i8> undef, +; CHECK-NEXT: Cost Model: Found an estimated cost of 552 for instruction: %V64i8 = srem <64 x i8> undef, +; CHECK-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret i32 undef +; + %I64 = srem i64 undef, -16 + %V2i64 = srem <2 x i64> undef, + %V4i64 = srem <4 x i64> undef, + %V8i64 = srem <8 x i64> undef, + + %I32 = srem i32 undef, -16 + %V4i32 = srem <4 x i32> undef, + %V8i32 = srem <8 x i32> undef, + %V16i32 = srem <16 x i32> undef, + + %I16 = srem i16 undef, -16 + %V8i16 = srem <8 x i16> undef, + %V16i16 = srem <16 x i16> undef, + %V32i16 = srem <32 x i16> undef, + + %I8 = srem i8 undef, -16 + %V16i8 = srem <16 x i8> undef, + %V32i8 = srem <32 x i8> undef, + %V64i8 = srem <64 x i8> undef, + + ret i32 undef +} + +define i32 @urem_constnegpow2() { +; CHECK-LABEL: 'urem_constnegpow2' +; CHECK-NEXT: Cost Model: Found an estimated cost of 9 for instruction: %I64 = urem i64 undef, -16 +; CHECK-NEXT: Cost Model: Found an estimated cost of 12 for instruction: %V2i64 = urem <2 x i64> undef, +; CHECK-NEXT: Cost Model: Found an estimated cost of 24 for instruction: %V4i64 = urem <4 x i64> undef, +; CHECK-NEXT: Cost Model: Found an estimated cost of 48 for instruction: %V8i64 = urem <8 x i64> undef, +; CHECK-NEXT: Cost Model: Found an estimated cost of 3 for instruction: %I32 = urem i32 undef, -16 +; CHECK-NEXT: Cost Model: Found an estimated cost of 30 for instruction: %V4i32 = urem <4 x i32> undef, +; CHECK-NEXT: Cost Model: Found an estimated cost of 60 for instruction: %V8i32 = urem <8 x i32> undef, +; CHECK-NEXT: Cost Model: Found an estimated cost of 120 for instruction: %V16i32 = urem <16 x i32> undef, +; CHECK-NEXT: Cost Model: Found an estimated cost of 3 for instruction: %I16 = urem i16 undef, -16 +; CHECK-NEXT: Cost Model: Found an estimated cost of 66 for instruction: %V8i16 = urem <8 x i16> undef, +; CHECK-NEXT: Cost Model: Found an estimated cost of 132 for instruction: %V16i16 = urem <16 x i16> undef, +; CHECK-NEXT: Cost Model: Found an estimated cost of 264 for instruction: %V32i16 = urem <32 x i16> undef, +; CHECK-NEXT: Cost Model: Found an estimated cost of 3 for instruction: %I8 = urem i8 undef, -16 +; CHECK-NEXT: Cost Model: Found an estimated cost of 138 for instruction: %V16i8 = urem <16 x i8> undef, +; CHECK-NEXT: Cost Model: Found an estimated cost of 276 for instruction: %V32i8 = urem <32 x i8> undef, +; CHECK-NEXT: Cost Model: Found an estimated cost of 552 for instruction: %V64i8 = urem <64 x i8> undef, +; CHECK-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret i32 undef +; + %I64 = urem i64 undef, -16 + %V2i64 = urem <2 x i64> undef, + %V4i64 = urem <4 x i64> undef, + %V8i64 = urem <8 x i64> undef, + + %I32 = urem i32 undef, -16 + %V4i32 = urem <4 x i32> undef, + %V8i32 = urem <8 x i32> undef, + %V16i32 = urem <16 x i32> undef, + + %I16 = urem i16 undef, -16 + %V8i16 = urem <8 x i16> undef, + %V16i16 = urem <16 x i16> undef, + %V32i16 = urem <32 x i16> undef, + + %I8 = urem i8 undef, -16 + %V16i8 = urem <16 x i8> undef, + %V32i8 = urem <32 x i8> undef, + %V64i8 = urem <64 x i8> undef, + + ret i32 undef +} + +define i32 @srem_uniformconstnegpow2() { +; CHECK-LABEL: 'srem_uniformconstnegpow2' +; CHECK-NEXT: Cost Model: Found an estimated cost of 9 for instruction: %I64 = srem i64 undef, -16 +; CHECK-NEXT: Cost Model: Found an estimated cost of 24 for instruction: %V2i64 = srem <2 x i64> undef, +; CHECK-NEXT: Cost Model: Found an estimated cost of 48 for instruction: %V4i64 = srem <4 x i64> undef, +; CHECK-NEXT: Cost Model: Found an estimated cost of 96 for instruction: %V8i64 = srem <8 x i64> undef, +; CHECK-NEXT: Cost Model: Found an estimated cost of 3 for instruction: %I32 = srem i32 undef, -16 +; CHECK-NEXT: Cost Model: Found an estimated cost of 30 for instruction: %V4i32 = srem <4 x i32> undef, +; CHECK-NEXT: Cost Model: Found an estimated cost of 60 for instruction: %V8i32 = srem <8 x i32> undef, +; CHECK-NEXT: Cost Model: Found an estimated cost of 120 for instruction: %V16i32 = srem <16 x i32> undef, +; CHECK-NEXT: Cost Model: Found an estimated cost of 3 for instruction: %I16 = srem i16 undef, -16 +; CHECK-NEXT: Cost Model: Found an estimated cost of 66 for instruction: %V8i16 = srem <8 x i16> undef, +; CHECK-NEXT: Cost Model: Found an estimated cost of 132 for instruction: %V16i16 = srem <16 x i16> undef, +; CHECK-NEXT: Cost Model: Found an estimated cost of 264 for instruction: %V32i16 = srem <32 x i16> undef, +; CHECK-NEXT: Cost Model: Found an estimated cost of 3 for instruction: %I8 = srem i8 undef, -16 +; CHECK-NEXT: Cost Model: Found an estimated cost of 138 for instruction: %V16i8 = srem <16 x i8> undef, +; CHECK-NEXT: Cost Model: Found an estimated cost of 276 for instruction: %V32i8 = srem <32 x i8> undef, +; CHECK-NEXT: Cost Model: Found an estimated cost of 552 for instruction: %V64i8 = srem <64 x i8> undef, +; CHECK-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret i32 undef +; + %I64 = srem i64 undef, -16 + %V2i64 = srem <2 x i64> undef, + %V4i64 = srem <4 x i64> undef, + %V8i64 = srem <8 x i64> undef, + + %I32 = srem i32 undef, -16 + %V4i32 = srem <4 x i32> undef, + %V8i32 = srem <8 x i32> undef, + %V16i32 = srem <16 x i32> undef, + + %I16 = srem i16 undef, -16 + %V8i16 = srem <8 x i16> undef, + %V16i16 = srem <16 x i16> undef, + %V32i16 = srem <32 x i16> undef, + + %I8 = srem i8 undef, -16 + %V16i8 = srem <16 x i8> undef, + %V32i8 = srem <32 x i8> undef, + %V64i8 = srem <64 x i8> undef, + + ret i32 undef +} + +define i32 @urem_uniformconstnegpow2() { +; CHECK-LABEL: 'urem_uniformconstnegpow2' +; CHECK-NEXT: Cost Model: Found an estimated cost of 9 for instruction: %I64 = urem i64 undef, -16 +; CHECK-NEXT: Cost Model: Found an estimated cost of 24 for instruction: %V2i64 = urem <2 x i64> undef, +; CHECK-NEXT: Cost Model: Found an estimated cost of 48 for instruction: %V4i64 = urem <4 x i64> undef, +; CHECK-NEXT: Cost Model: Found an estimated cost of 96 for instruction: %V8i64 = urem <8 x i64> undef, +; CHECK-NEXT: Cost Model: Found an estimated cost of 3 for instruction: %I32 = urem i32 undef, -16 +; CHECK-NEXT: Cost Model: Found an estimated cost of 30 for instruction: %V4i32 = urem <4 x i32> undef, +; CHECK-NEXT: Cost Model: Found an estimated cost of 60 for instruction: %V8i32 = urem <8 x i32> undef, +; CHECK-NEXT: Cost Model: Found an estimated cost of 120 for instruction: %V16i32 = urem <16 x i32> undef, +; CHECK-NEXT: Cost Model: Found an estimated cost of 3 for instruction: %I16 = urem i16 undef, -16 +; CHECK-NEXT: Cost Model: Found an estimated cost of 66 for instruction: %V8i16 = urem <8 x i16> undef, +; CHECK-NEXT: Cost Model: Found an estimated cost of 132 for instruction: %V16i16 = urem <16 x i16> undef, +; CHECK-NEXT: Cost Model: Found an estimated cost of 264 for instruction: %V32i16 = urem <32 x i16> undef, +; CHECK-NEXT: Cost Model: Found an estimated cost of 3 for instruction: %I8 = urem i8 undef, -16 +; CHECK-NEXT: Cost Model: Found an estimated cost of 138 for instruction: %V16i8 = urem <16 x i8> undef, +; CHECK-NEXT: Cost Model: Found an estimated cost of 276 for instruction: %V32i8 = urem <32 x i8> undef, +; CHECK-NEXT: Cost Model: Found an estimated cost of 552 for instruction: %V64i8 = urem <64 x i8> undef, +; CHECK-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret i32 undef +; + %I64 = urem i64 undef, -16 + %V2i64 = urem <2 x i64> undef, + %V4i64 = urem <4 x i64> undef, + %V8i64 = urem <8 x i64> undef, + + %I32 = urem i32 undef, -16 + %V4i32 = urem <4 x i32> undef, + %V8i32 = urem <8 x i32> undef, + %V16i32 = urem <16 x i32> undef, + + %I16 = urem i16 undef, -16 + %V8i16 = urem <8 x i16> undef, + %V16i16 = urem <16 x i16> undef, + %V32i16 = urem <32 x i16> undef, + + %I8 = urem i8 undef, -16 + %V16i8 = urem <16 x i8> undef, + %V32i8 = urem <32 x i8> undef, + %V64i8 = urem <64 x i8> undef, + + ret i32 undef +}