Clang Project

clang_source_code/test/CodeGen/neon-immediate-ubsan.c
1// RUN: %clang_cc1 -triple armv7s-linux-gnu -target-abi apcs-gnu -emit-llvm -o - %s \
2// RUN:     -target-feature +neon -target-cpu cortex-a8 \
3// RUN:     -fsanitize=signed-integer-overflow \
4// RUN:   | FileCheck %s --check-prefix=CHECK --check-prefix=ARMV7
5
6// RUN: %clang_cc1 -triple aarch64-unknown-unknown -emit-llvm -o - %s \
7// RUN:     -target-feature +neon -target-cpu cortex-a53 \
8// RUN:     -fsanitize=signed-integer-overflow \
9// RUN:   | FileCheck %s --check-prefix=CHECK --check-prefix=AARCH64
10
11// Verify we emit constants for "immediate" builtin arguments.
12// Emitting a scalar expression can make the immediate be generated as
13// overflow intrinsics, if the overflow sanitizer is enabled.
14
15// PR23517
16
17#include <arm_neon.h>
18
19int32x2_t test_vqrshrn_n_s64(int64x2_t a) {
20  // CHECK-LABEL: @test_vqrshrn_n_s64
21  // CHECK-AARCH64: call <2 x i32> @llvm.aarch64.neon.sqrshrn.v2i32(<2 x i64> {{.*}}, i32 1)
22  // CHECK-ARMV7: call <2 x i32> @llvm.arm.neon.vqrshiftns.v2i32(<2 x i64> {{.*}}, <2 x i64> <i64 -1, i64 -1>)
23  return vqrshrn_n_s64(a, 0 + 1);
24}
25