CodeQL / Analyze (actions) (push) Canceled after 0s
CodeQL / Analyze (python) (push) Canceled after 0s
pre-commit / pre-commit (push) Canceled after 0s
Multi-Arch CI / setup (push) Canceled after 0s
Publish build_manylinux_x86_64 images / publish_build_manylinux_x86_64 (push) Canceled after 0s
Setup (Multi-Arch) / setup (push) Canceled after 0s
Multi-Arch CI / Linux::${{ fromJSON(needs.setup.outputs.linux_build_config || '{}').build_variant_label || 'skip' }} (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish no_rocm_image_ubi10 image / publish_no_rocm_image_ubi10 (push) Canceled after 0s
Multi-Arch CI / Windows::${{ fromJSON(needs.setup.outputs.windows_build_config || '{}').build_variant_label || 'skip' }} (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Multi-Arch CI / Manifest Diff (push) Canceled after 0s
TheRock Manifest Diff Report / Generate Manifest Diff Report (push) Canceled after 0s
Multi-Arch CI / CI Summary (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04 (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04_ocl_rt images / publish_no_rocm_image_ubuntu24_04_ocl_rt (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_rocgdb (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04_rocgdb images / publish_no_rocm_image_ubuntu24_04_rocgdb (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_ocl_rt (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Unit Tests / Unit Tests :: ubuntu-24.04 (push) Canceled after 0s
Unit Tests / Unit Tests :: windows-2022 (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_media (push) Canceled after 0s
Unit Tests / Unit Tests Summary (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_openmpi (push) Canceled after 0s
105 lines
4.1 KiB
LLVM
105 lines
4.1 KiB
LLVM
; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
|
|
; RUN: opt < %s -passes=instcombine -S -data-layout=e-n32 | FileCheck %s --check-prefix=ALL --check-prefix=LE
|
|
; RUN: opt < %s -passes=instcombine -S -data-layout=E-n32 | FileCheck %s --check-prefix=ALL --check-prefix=BE
|
|
|
|
; RUN: opt < %s -passes=instcombine -S -data-layout=e-n32 -use-constant-int-for-fixed-length-splat | FileCheck %s --check-prefix=ALL --check-prefix=LE
|
|
; RUN: opt < %s -passes=instcombine -S -data-layout=E-n32 -use-constant-int-for-fixed-length-splat | FileCheck %s --check-prefix=ALL --check-prefix=BE
|
|
|
|
declare i32 @memcmp(ptr, ptr, i64)
|
|
|
|
; The alignment of this constant does not matter. We constant fold the load.
|
|
|
|
@charbuf = private unnamed_addr constant [4 x i8] [i8 0, i8 0, i8 0, i8 1], align 1
|
|
|
|
define i1 @memcmp_4bytes_unaligned_constant_i8(ptr align 4 %x) {
|
|
; LE-LABEL: @memcmp_4bytes_unaligned_constant_i8(
|
|
; LE-NEXT: [[LHSV:%.*]] = load i32, ptr [[X:%.*]], align 4
|
|
; LE-NEXT: [[DOTNOT:%.*]] = icmp eq i32 [[LHSV]], 16777216
|
|
; LE-NEXT: ret i1 [[DOTNOT]]
|
|
;
|
|
; BE-LABEL: @memcmp_4bytes_unaligned_constant_i8(
|
|
; BE-NEXT: [[LHSV:%.*]] = load i32, ptr [[X:%.*]], align 4
|
|
; BE-NEXT: [[DOTNOT:%.*]] = icmp eq i32 [[LHSV]], 1
|
|
; BE-NEXT: ret i1 [[DOTNOT]]
|
|
;
|
|
%call = tail call i32 @memcmp(ptr %x, ptr @charbuf, i64 4)
|
|
%cmpeq0 = icmp eq i32 %call, 0
|
|
ret i1 %cmpeq0
|
|
}
|
|
|
|
; We still don't care about alignment of the constant. We are not limited to constant folding only i8 arrays.
|
|
; It doesn't matter if the constant operand is the first operand to the memcmp.
|
|
|
|
@intbuf_unaligned = private unnamed_addr constant [4 x i16] [i16 1, i16 2, i16 3, i16 4], align 1
|
|
|
|
define i1 @memcmp_4bytes_unaligned_constant_i16(ptr align 4 %x) {
|
|
; LE-LABEL: @memcmp_4bytes_unaligned_constant_i16(
|
|
; LE-NEXT: [[RHSV:%.*]] = load i32, ptr [[X:%.*]], align 4
|
|
; LE-NEXT: [[DOTNOT:%.*]] = icmp eq i32 [[RHSV]], 131073
|
|
; LE-NEXT: ret i1 [[DOTNOT]]
|
|
;
|
|
; BE-LABEL: @memcmp_4bytes_unaligned_constant_i16(
|
|
; BE-NEXT: [[RHSV:%.*]] = load i32, ptr [[X:%.*]], align 4
|
|
; BE-NEXT: [[DOTNOT:%.*]] = icmp eq i32 [[RHSV]], 65538
|
|
; BE-NEXT: ret i1 [[DOTNOT]]
|
|
;
|
|
%call = tail call i32 @memcmp(ptr @intbuf_unaligned, ptr %x, i64 4)
|
|
%cmpeq0 = icmp eq i32 %call, 0
|
|
ret i1 %cmpeq0
|
|
}
|
|
|
|
; Verify that a memcmp call where all arguments are constants is constant
|
|
; folded even for arrays of other types than i8.
|
|
|
|
@intbuf = private unnamed_addr constant [2 x i32] [i32 0, i32 1], align 4
|
|
|
|
define i1 @memcmp_3bytes_aligned_constant_i32(ptr align 4 %x) {
|
|
; LE-LABEL: @memcmp_3bytes_aligned_constant_i32(
|
|
; LE-NEXT: ret i1 false
|
|
;
|
|
; BE-LABEL: @memcmp_3bytes_aligned_constant_i32(
|
|
; BE-NEXT: ret i1 true
|
|
;
|
|
%call = tail call i32 @memcmp(ptr getelementptr inbounds ([2 x i32], ptr @intbuf, i64 0, i64 1), ptr @intbuf, i64 3)
|
|
%cmpeq0 = icmp eq i32 %call, 0
|
|
ret i1 %cmpeq0
|
|
}
|
|
|
|
; A sloppy implementation would infinite loop by recreating the unused instructions.
|
|
|
|
define i1 @memcmp_4bytes_one_unaligned_i8(ptr align 4 %x, ptr align 1 %y) {
|
|
; ALL-LABEL: @memcmp_4bytes_one_unaligned_i8(
|
|
; ALL-NEXT: [[CALL:%.*]] = tail call i32 @memcmp(ptr noundef nonnull dereferenceable(4) [[X:%.*]], ptr noundef nonnull dereferenceable(4) [[Y:%.*]], i64 4)
|
|
; ALL-NEXT: [[CMPEQ0:%.*]] = icmp eq i32 [[CALL]], 0
|
|
; ALL-NEXT: ret i1 [[CMPEQ0]]
|
|
;
|
|
%lhsv = load i32, ptr %x
|
|
%call = tail call i32 @memcmp(ptr %x, ptr %y, i64 4)
|
|
%cmpeq0 = icmp eq i32 %call, 0
|
|
ret i1 %cmpeq0
|
|
}
|
|
|
|
;
|
|
|
|
@constant_splat_vector_fp = constant <4 x i128> splat (i128 1), align 16
|
|
@constant_vector_fp = constant <4 x i128> <i128 1, i128 0, i128 0, i128 0>, align 16
|
|
|
|
define i32 @memcmp_vector_constant_fp() {
|
|
; ALL-LABEL: @memcmp_vector_constant_fp(
|
|
; ALL-NEXT: ret i32 1
|
|
;
|
|
%r = call i32 @memcmp(ptr @constant_splat_vector_fp, ptr @constant_vector_fp, i64 64)
|
|
ret i32 %r
|
|
}
|
|
|
|
@constant_splat_vector_int = constant <4 x float> splat (float 1.0), align 16
|
|
@constant_vector_int = constant <4 x float> <float 1.0, float 1.0, float 1.0, float 1.0>, align 16
|
|
|
|
define i32 @memcmp_vector_constant_int() {
|
|
; ALL-LABEL: @memcmp_vector_constant_int(
|
|
; ALL-NEXT: ret i32 0
|
|
;
|
|
%r = call i32 @memcmp(ptr @constant_splat_vector_int, ptr @constant_vector_int, i64 16)
|
|
ret i32 %r
|
|
}
|