[llvm] 714286f - [NFC] Precommit tests

Samuel Parker via llvm-commits llvm-commits at lists.llvm.org
Fri Jan 20 05:17:43 PST 2023


Author: Samuel Parker
Date: 2023-01-20T13:17:34Z
New Revision: 714286f9e641209411609deaf80dd865aa2198c5

URL: https://github.com/llvm/llvm-project/commit/714286f9e641209411609deaf80dd865aa2198c5
DIFF: https://github.com/llvm/llvm-project/commit/714286f9e641209411609deaf80dd865aa2198c5.diff

LOG: [NFC] Precommit tests

For (trunc (fp-to-int)).

Added: 
    llvm/test/Transforms/InstCombine/trunc-fp-to-int.ll

Modified: 
    

Removed: 
    


################################################################################
diff  --git a/llvm/test/Transforms/InstCombine/trunc-fp-to-int.ll b/llvm/test/Transforms/InstCombine/trunc-fp-to-int.ll
new file mode 100644
index 000000000000..e8d16e9d6353
--- /dev/null
+++ b/llvm/test/Transforms/InstCombine/trunc-fp-to-int.ll
@@ -0,0 +1,407 @@
+; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
+; RUN: opt -passes=instcombine -S -o - %s | FileCheck %s
+
+; Negative test.
+define i15 @half_fptoui_i32_i15(half %x) {
+; CHECK-LABEL: @half_fptoui_i32_i15(
+; CHECK-NEXT:    [[CONV:%.*]] = fptoui half [[X:%.*]] to i32
+; CHECK-NEXT:    [[CONV_1:%.*]] = trunc i32 [[CONV]] to i15
+; CHECK-NEXT:    ret i15 [[CONV_1]]
+;
+  %conv = fptoui half %x to i32
+  %conv.1 = trunc i32 %conv to i15
+  ret i15 %conv.1
+}
+
+; Negative test.
+define i15 @half_fptoui_i32_i15_noundef(half noundef %x) {
+; CHECK-LABEL: @half_fptoui_i32_i15_noundef(
+; CHECK-NEXT:    [[CONV:%.*]] = fptoui half [[X:%.*]] to i32
+; CHECK-NEXT:    [[CONV_1:%.*]] = trunc i32 [[CONV]] to i15
+; CHECK-NEXT:    ret i15 [[CONV_1]]
+;
+  %conv = fptoui half %x to i32
+  %conv.1 = trunc i32 %conv to i15
+  ret i15 %conv.1
+}
+
+define i16 @half_fptoui_i17_i16(half %x) {
+; CHECK-LABEL: @half_fptoui_i17_i16(
+; CHECK-NEXT:    [[CONV:%.*]] = fptoui half [[X:%.*]] to i17
+; CHECK-NEXT:    [[CONV_1:%.*]] = trunc i17 [[CONV]] to i16
+; CHECK-NEXT:    ret i16 [[CONV_1]]
+;
+  %conv = fptoui half %x to i17
+  %conv.1 = trunc i17 %conv to i16
+  ret i16 %conv.1
+}
+
+define i16 @half_fptoui_i17_i16_noundef(half noundef %x) {
+; CHECK-LABEL: @half_fptoui_i17_i16_noundef(
+; CHECK-NEXT:    [[CONV:%.*]] = fptoui half [[X:%.*]] to i17
+; CHECK-NEXT:    [[CONV_1:%.*]] = trunc i17 [[CONV]] to i16
+; CHECK-NEXT:    ret i16 [[CONV_1]]
+;
+  %conv = fptoui half %x to i17
+  %conv.1 = trunc i17 %conv to i16
+  ret i16 %conv.1
+}
+
+define i16 @half_fptoui_i32_i16(half %x) {
+; CHECK-LABEL: @half_fptoui_i32_i16(
+; CHECK-NEXT:    [[CONV:%.*]] = fptoui half [[X:%.*]] to i32
+; CHECK-NEXT:    [[CONV_1:%.*]] = trunc i32 [[CONV]] to i16
+; CHECK-NEXT:    ret i16 [[CONV_1]]
+;
+  %conv = fptoui half %x to i32
+  %conv.1 = trunc i32 %conv to i16
+  ret i16 %conv.1
+}
+
+define i16 @half_fptoui_i32_i16_noundef(half noundef %x) {
+; CHECK-LABEL: @half_fptoui_i32_i16_noundef(
+; CHECK-NEXT:    [[CONV:%.*]] = fptoui half [[X:%.*]] to i32
+; CHECK-NEXT:    [[CONV_1:%.*]] = trunc i32 [[CONV]] to i16
+; CHECK-NEXT:    ret i16 [[CONV_1]]
+;
+  %conv = fptoui half %x to i32
+  %conv.1 = trunc i32 %conv to i16
+  ret i16 %conv.1
+}
+
+; TODO: i17 is not explored.
+define i17 @half_fptoui_i32_i17(half %x) {
+; CHECK-LABEL: @half_fptoui_i32_i17(
+; CHECK-NEXT:    [[CONV:%.*]] = fptoui half [[X:%.*]] to i32
+; CHECK-NEXT:    [[CONV_1:%.*]] = trunc i32 [[CONV]] to i17
+; CHECK-NEXT:    ret i17 [[CONV_1]]
+;
+  %conv = fptoui half %x to i32
+  %conv.1 = trunc i32 %conv to i17
+  ret i17 %conv.1
+}
+
+; TODO: i17 is not explored.
+define i17 @half_fptoui_i32_i17_noundef(half noundef %x) {
+; CHECK-LABEL: @half_fptoui_i32_i17_noundef(
+; CHECK-NEXT:    [[CONV:%.*]] = fptoui half [[X:%.*]] to i32
+; CHECK-NEXT:    [[CONV_1:%.*]] = trunc i32 [[CONV]] to i17
+; CHECK-NEXT:    ret i17 [[CONV_1]]
+;
+  %conv = fptoui half %x to i32
+  %conv.1 = trunc i32 %conv to i17
+  ret i17 %conv.1
+}
+
+define <4 x i16> @half_fptoui_4xi32_4xi16(<4 x half> %x) {
+; CHECK-LABEL: @half_fptoui_4xi32_4xi16(
+; CHECK-NEXT:    [[CONV:%.*]] = fptoui <4 x half> [[X:%.*]] to <4 x i32>
+; CHECK-NEXT:    [[CONV_1:%.*]] = trunc <4 x i32> [[CONV]] to <4 x i16>
+; CHECK-NEXT:    ret <4 x i16> [[CONV_1]]
+;
+  %conv = fptoui <4 x half> %x to <4 x i32>
+  %conv.1 = trunc <4 x i32> %conv to <4 x i16>
+  ret <4 x i16> %conv.1
+}
+
+define <4 x i16> @half_fptoui_4xi32_4xi16_noundef(<4 x half> noundef %x) {
+; CHECK-LABEL: @half_fptoui_4xi32_4xi16_noundef(
+; CHECK-NEXT:    [[CONV:%.*]] = fptoui <4 x half> [[X:%.*]] to <4 x i32>
+; CHECK-NEXT:    [[CONV_1:%.*]] = trunc <4 x i32> [[CONV]] to <4 x i16>
+; CHECK-NEXT:    ret <4 x i16> [[CONV_1]]
+;
+  %conv = fptoui <4 x half> %x to <4 x i32>
+  %conv.1 = trunc <4 x i32> %conv to <4 x i16>
+  ret <4 x i16> %conv.1
+}
+
+; Negative test.
+define i31 @float_fptoui_i64_i31(float %x) {
+; CHECK-LABEL: @float_fptoui_i64_i31(
+; CHECK-NEXT:    [[CONV:%.*]] = fptoui float [[X:%.*]] to i64
+; CHECK-NEXT:    [[CONV_1:%.*]] = trunc i64 [[CONV]] to i31
+; CHECK-NEXT:    ret i31 [[CONV_1]]
+;
+  %conv = fptoui float %x to i64
+  %conv.1 = trunc i64 %conv to i31
+  ret i31 %conv.1
+}
+
+; Negative test.
+define i31 @float_fptoui_i64_i31_noundef(float noundef %x) {
+; CHECK-LABEL: @float_fptoui_i64_i31_noundef(
+; CHECK-NEXT:    [[CONV:%.*]] = fptoui float [[X:%.*]] to i64
+; CHECK-NEXT:    [[CONV_1:%.*]] = trunc i64 [[CONV]] to i31
+; CHECK-NEXT:    ret i31 [[CONV_1]]
+;
+  %conv = fptoui float %x to i64
+  %conv.1 = trunc i64 %conv to i31
+  ret i31 %conv.1
+}
+
+; Negative test.
+define i32 @float_fptoui_i64_i32(float %x) {
+; CHECK-LABEL: @float_fptoui_i64_i32(
+; CHECK-NEXT:    [[CONV:%.*]] = fptoui float [[X:%.*]] to i64
+; CHECK-NEXT:    [[CONV_1:%.*]] = trunc i64 [[CONV]] to i32
+; CHECK-NEXT:    ret i32 [[CONV_1]]
+;
+  %conv = fptoui float %x to i64
+  %conv.1 = trunc i64 %conv to i32
+  ret i32 %conv.1
+}
+
+; Negative test.
+define i32 @float_fptoui_i64_i32_noundef(float noundef %x) {
+; CHECK-LABEL: @float_fptoui_i64_i32_noundef(
+; CHECK-NEXT:    [[CONV:%.*]] = fptoui float [[X:%.*]] to i64
+; CHECK-NEXT:    [[CONV_1:%.*]] = trunc i64 [[CONV]] to i32
+; CHECK-NEXT:    ret i32 [[CONV_1]]
+;
+  %conv = fptoui float %x to i64
+  %conv.1 = trunc i64 %conv to i32
+  ret i32 %conv.1
+}
+
+define i33 @float_fptoui_i64_i33(float %x) {
+; CHECK-LABEL: @float_fptoui_i64_i33(
+; CHECK-NEXT:    [[CONV:%.*]] = fptoui float [[X:%.*]] to i64
+; CHECK-NEXT:    [[CONV_1:%.*]] = trunc i64 [[CONV]] to i33
+; CHECK-NEXT:    ret i33 [[CONV_1]]
+;
+  %conv = fptoui float %x to i64
+  %conv.1 = trunc i64 %conv to i33
+  ret i33 %conv.1
+}
+
+define i33 @float_fptoui_i64_i33_noundef(float noundef %x) {
+; CHECK-LABEL: @float_fptoui_i64_i33_noundef(
+; CHECK-NEXT:    [[CONV:%.*]] = fptoui float [[X:%.*]] to i64
+; CHECK-NEXT:    [[CONV_1:%.*]] = trunc i64 [[CONV]] to i33
+; CHECK-NEXT:    ret i33 [[CONV_1]]
+;
+  %conv = fptoui float %x to i64
+  %conv.1 = trunc i64 %conv to i33
+  ret i33 %conv.1
+}
+
+define i64 @float_fptoui_i128_i64(float %x) {
+; CHECK-LABEL: @float_fptoui_i128_i64(
+; CHECK-NEXT:    [[CONV:%.*]] = fptoui float [[X:%.*]] to i128
+; CHECK-NEXT:    [[CONV_1:%.*]] = trunc i128 [[CONV]] to i64
+; CHECK-NEXT:    ret i64 [[CONV_1]]
+;
+  %conv = fptoui float %x to i128
+  %conv.1 = trunc i128 %conv to i64
+  ret i64 %conv.1
+}
+
+define i64 @float_fptoui_i128_i64_noundef(float noundef %x) {
+; CHECK-LABEL: @float_fptoui_i128_i64_noundef(
+; CHECK-NEXT:    [[CONV:%.*]] = fptoui float [[X:%.*]] to i128
+; CHECK-NEXT:    [[CONV_1:%.*]] = trunc i128 [[CONV]] to i64
+; CHECK-NEXT:    ret i64 [[CONV_1]]
+;
+  %conv = fptoui float %x to i128
+  %conv.1 = trunc i128 %conv to i64
+  ret i64 %conv.1
+}
+
+; Negative test.
+define i15 @half_fptosi_i32_i15(half %x) {
+; CHECK-LABEL: @half_fptosi_i32_i15(
+; CHECK-NEXT:    [[CONV:%.*]] = fptosi half [[X:%.*]] to i32
+; CHECK-NEXT:    [[CONV_1:%.*]] = trunc i32 [[CONV]] to i15
+; CHECK-NEXT:    ret i15 [[CONV_1]]
+;
+  %conv = fptosi half %x to i32
+  %conv.1 = trunc i32 %conv to i15
+  ret i15 %conv.1
+}
+
+; Negative test.
+define i15 @half_fptosi_i32_i15_noundef(half noundef %x) {
+; CHECK-LABEL: @half_fptosi_i32_i15_noundef(
+; CHECK-NEXT:    [[CONV:%.*]] = fptosi half [[X:%.*]] to i32
+; CHECK-NEXT:    [[CONV_1:%.*]] = trunc i32 [[CONV]] to i15
+; CHECK-NEXT:    ret i15 [[CONV_1]]
+;
+  %conv = fptosi half %x to i32
+  %conv.1 = trunc i32 %conv to i15
+  ret i15 %conv.1
+}
+
+; Negative test.
+define i16 @half_fptosi_i32_i16(half %x) {
+; CHECK-LABEL: @half_fptosi_i32_i16(
+; CHECK-NEXT:    [[CONV:%.*]] = fptosi half [[X:%.*]] to i32
+; CHECK-NEXT:    [[CONV_1:%.*]] = trunc i32 [[CONV]] to i16
+; CHECK-NEXT:    ret i16 [[CONV_1]]
+;
+  %conv = fptosi half %x to i32
+  %conv.1 = trunc i32 %conv to i16
+  ret i16 %conv.1
+}
+
+; Negative test.
+define i16 @half_fptosi_i32_i16_noundef(half noundef %x) {
+; CHECK-LABEL: @half_fptosi_i32_i16_noundef(
+; CHECK-NEXT:    [[CONV:%.*]] = fptosi half [[X:%.*]] to i32
+; CHECK-NEXT:    [[CONV_1:%.*]] = trunc i32 [[CONV]] to i16
+; CHECK-NEXT:    ret i16 [[CONV_1]]
+;
+  %conv = fptosi half %x to i32
+  %conv.1 = trunc i32 %conv to i16
+  ret i16 %conv.1
+}
+
+; TODO: i17 isn't explored.
+define i17 @half_fptosi_i32_i17(half %x) {
+; CHECK-LABEL: @half_fptosi_i32_i17(
+; CHECK-NEXT:    [[CONV:%.*]] = fptosi half [[X:%.*]] to i32
+; CHECK-NEXT:    [[CONV_1:%.*]] = trunc i32 [[CONV]] to i17
+; CHECK-NEXT:    ret i17 [[CONV_1]]
+;
+  %conv = fptosi half %x to i32
+  %conv.1 = trunc i32 %conv to i17
+  ret i17 %conv.1
+}
+
+; TODO: i17 isn't explored.
+define i17 @half_fptosi_i32_i17_noundef(half noundef %x) {
+; CHECK-LABEL: @half_fptosi_i32_i17_noundef(
+; CHECK-NEXT:    [[CONV:%.*]] = fptosi half [[X:%.*]] to i32
+; CHECK-NEXT:    [[CONV_1:%.*]] = trunc i32 [[CONV]] to i17
+; CHECK-NEXT:    ret i17 [[CONV_1]]
+;
+  %conv = fptosi half %x to i32
+  %conv.1 = trunc i32 %conv to i17
+  ret i17 %conv.1
+}
+
+; Negative test.
+define <4 x i16> @half_fptosi_4xi32_4xi16(<4 x half> %x) {
+; CHECK-LABEL: @half_fptosi_4xi32_4xi16(
+; CHECK-NEXT:    [[CONV:%.*]] = fptosi <4 x half> [[X:%.*]] to <4 x i32>
+; CHECK-NEXT:    [[CONV_1:%.*]] = trunc <4 x i32> [[CONV]] to <4 x i16>
+; CHECK-NEXT:    ret <4 x i16> [[CONV_1]]
+;
+  %conv = fptosi <4 x half> %x to <4 x i32>
+  %conv.1 = trunc <4 x i32> %conv to <4 x i16>
+  ret <4 x i16> %conv.1
+}
+
+; Negative test.
+define <4 x i16> @half_fptosi_4xi32_4xi16_noundef(<4 x half> noundef %x) {
+; CHECK-LABEL: @half_fptosi_4xi32_4xi16_noundef(
+; CHECK-NEXT:    [[CONV:%.*]] = fptosi <4 x half> [[X:%.*]] to <4 x i32>
+; CHECK-NEXT:    [[CONV_1:%.*]] = trunc <4 x i32> [[CONV]] to <4 x i16>
+; CHECK-NEXT:    ret <4 x i16> [[CONV_1]]
+;
+  %conv = fptosi <4 x half> %x to <4 x i32>
+  %conv.1 = trunc <4 x i32> %conv to <4 x i16>
+  ret <4 x i16> %conv.1
+}
+
+define <4 x i32> @half_fptosi_4xi64_4xi32(<4 x half> %x) {
+; CHECK-LABEL: @half_fptosi_4xi64_4xi32(
+; CHECK-NEXT:    [[CONV:%.*]] = fptosi <4 x half> [[X:%.*]] to <4 x i64>
+; CHECK-NEXT:    [[CONV_1:%.*]] = trunc <4 x i64> [[CONV]] to <4 x i32>
+; CHECK-NEXT:    ret <4 x i32> [[CONV_1]]
+;
+  %conv = fptosi <4 x half> %x to <4 x i64>
+  %conv.1 = trunc <4 x i64> %conv to <4 x i32>
+  ret <4 x i32> %conv.1
+}
+
+; Negative test.
+define i31 @float_fptosi_i64_i31(float %x) {
+; CHECK-LABEL: @float_fptosi_i64_i31(
+; CHECK-NEXT:    [[CONV:%.*]] = fptosi float [[X:%.*]] to i64
+; CHECK-NEXT:    [[CONV_1:%.*]] = trunc i64 [[CONV]] to i31
+; CHECK-NEXT:    ret i31 [[CONV_1]]
+;
+  %conv = fptosi float %x to i64
+  %conv.1 = trunc i64 %conv to i31
+  ret i31 %conv.1
+}
+
+; Negative test.
+define i31 @float_fptosi_i64_i31_noundef(float noundef %x) {
+; CHECK-LABEL: @float_fptosi_i64_i31_noundef(
+; CHECK-NEXT:    [[CONV:%.*]] = fptosi float [[X:%.*]] to i64
+; CHECK-NEXT:    [[CONV_1:%.*]] = trunc i64 [[CONV]] to i31
+; CHECK-NEXT:    ret i31 [[CONV_1]]
+;
+  %conv = fptosi float %x to i64
+  %conv.1 = trunc i64 %conv to i31
+  ret i31 %conv.1
+}
+
+; Negative test.
+define i32 @float_fptosi_i64_i32(float %x) {
+; CHECK-LABEL: @float_fptosi_i64_i32(
+; CHECK-NEXT:    [[CONV:%.*]] = fptosi float [[X:%.*]] to i64
+; CHECK-NEXT:    [[CONV_1:%.*]] = trunc i64 [[CONV]] to i32
+; CHECK-NEXT:    ret i32 [[CONV_1]]
+;
+  %conv = fptosi float %x to i64
+  %conv.1 = trunc i64 %conv to i32
+  ret i32 %conv.1
+}
+
+; Negative test.
+define i32 @float_fptosi_i64_i32_noundef(float noundef %x) {
+; CHECK-LABEL: @float_fptosi_i64_i32_noundef(
+; CHECK-NEXT:    [[CONV:%.*]] = fptosi float [[X:%.*]] to i64
+; CHECK-NEXT:    [[CONV_1:%.*]] = trunc i64 [[CONV]] to i32
+; CHECK-NEXT:    ret i32 [[CONV_1]]
+;
+  %conv = fptosi float %x to i64
+  %conv.1 = trunc i64 %conv to i32
+  ret i32 %conv.1
+}
+
+define i33 @float_fptosi_i64_i33(float %x) {
+; CHECK-LABEL: @float_fptosi_i64_i33(
+; CHECK-NEXT:    [[CONV:%.*]] = fptosi float [[X:%.*]] to i64
+; CHECK-NEXT:    [[CONV_1:%.*]] = trunc i64 [[CONV]] to i33
+; CHECK-NEXT:    ret i33 [[CONV_1]]
+;
+  %conv = fptosi float %x to i64
+  %conv.1 = trunc i64 %conv to i33
+  ret i33 %conv.1
+}
+
+define i33 @float_fptosi_i64_i33_noundef(float noundef %x) {
+; CHECK-LABEL: @float_fptosi_i64_i33_noundef(
+; CHECK-NEXT:    [[CONV:%.*]] = fptosi float [[X:%.*]] to i64
+; CHECK-NEXT:    [[CONV_1:%.*]] = trunc i64 [[CONV]] to i33
+; CHECK-NEXT:    ret i33 [[CONV_1]]
+;
+  %conv = fptosi float %x to i64
+  %conv.1 = trunc i64 %conv to i33
+  ret i33 %conv.1
+}
+
+define i64 @float_fptosi_i128_i64(float %x) {
+; CHECK-LABEL: @float_fptosi_i128_i64(
+; CHECK-NEXT:    [[CONV:%.*]] = fptosi float [[X:%.*]] to i128
+; CHECK-NEXT:    [[CONV_1:%.*]] = trunc i128 [[CONV]] to i64
+; CHECK-NEXT:    ret i64 [[CONV_1]]
+;
+  %conv = fptosi float %x to i128
+  %conv.1 = trunc i128 %conv to i64
+  ret i64 %conv.1
+}
+
+define i64 @float_fptosi_i128_i64_noundef(float noundef %x) {
+; CHECK-LABEL: @float_fptosi_i128_i64_noundef(
+; CHECK-NEXT:    [[CONV:%.*]] = fptosi float [[X:%.*]] to i128
+; CHECK-NEXT:    [[CONV_1:%.*]] = trunc i128 [[CONV]] to i64
+; CHECK-NEXT:    ret i64 [[CONV_1]]
+;
+  %conv = fptosi float %x to i128
+  %conv.1 = trunc i128 %conv to i64
+  ret i64 %conv.1
+}


        


More information about the llvm-commits mailing list