Skip to content

Commit 294b088

Browse files
authored
Merge branch 'main' into pr/thead-name
2 parents aae440a + d0d84c4 commit 294b088

File tree

24 files changed

+774
-253
lines changed

24 files changed

+774
-253
lines changed

clang/lib/CodeGen/TargetBuiltins/ARM.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -850,8 +850,8 @@ static const ARMVectorIntrinsicInfo ARMSIMDIntrinsicMap [] = {
850850
NEONMAP1(vrndp_v, ceil, Add1ArgType),
851851
NEONMAP1(vrndpq_v, ceil, Add1ArgType),
852852
NEONMAP1(vrndq_v, trunc, Add1ArgType),
853-
NEONMAP1(vrndx_v, arm_neon_vrintx, Add1ArgType),
854-
NEONMAP1(vrndxq_v, arm_neon_vrintx, Add1ArgType),
853+
NEONMAP1(vrndx_v, rint, Add1ArgType),
854+
NEONMAP1(vrndxq_v, rint, Add1ArgType),
855855
NEONMAP2(vrshl_v, arm_neon_vrshiftu, arm_neon_vrshifts, Add1ArgType | UnsignedAlts),
856856
NEONMAP2(vrshlq_v, arm_neon_vrshiftu, arm_neon_vrshifts, Add1ArgType | UnsignedAlts),
857857
NEONMAP2(vrshr_n_v, arm_neon_vrshiftu, arm_neon_vrshifts, UnsignedAlts),

clang/test/CodeGen/arm-neon-directed-rounding.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -216,7 +216,7 @@ float32x4_t test_vrndpq_f32(float32x4_t a) {
216216
// CHECK-A32-NEXT: [[TMP0:%.*]] = bitcast <2 x float> [[A]] to <2 x i32>
217217
// CHECK-A32-NEXT: [[TMP1:%.*]] = bitcast <2 x i32> [[TMP0]] to <8 x i8>
218218
// CHECK-A32-NEXT: [[VRNDX_V_I:%.*]] = bitcast <8 x i8> [[TMP1]] to <2 x float>
219-
// CHECK-A32-NEXT: [[VRNDX_V1_I:%.*]] = call <2 x float> @llvm.arm.neon.vrintx.v2f32(<2 x float> [[VRNDX_V_I]])
219+
// CHECK-A32-NEXT: [[VRNDX_V1_I:%.*]] = call <2 x float> @llvm.rint.v2f32(<2 x float> [[VRNDX_V_I]])
220220
// CHECK-A32-NEXT: [[VRNDX_V2_I:%.*]] = bitcast <2 x float> [[VRNDX_V1_I]] to <8 x i8>
221221
// CHECK-A32-NEXT: [[TMP2:%.*]] = bitcast <8 x i8> [[VRNDX_V2_I]] to <2 x i32>
222222
// CHECK-A32-NEXT: [[TMP3:%.*]] = bitcast <2 x i32> [[TMP2]] to <2 x float>
@@ -241,7 +241,7 @@ float32x2_t test_vrndx_f32(float32x2_t a) {
241241
// CHECK-A32-NEXT: [[TMP0:%.*]] = bitcast <4 x float> [[A]] to <4 x i32>
242242
// CHECK-A32-NEXT: [[TMP1:%.*]] = bitcast <4 x i32> [[TMP0]] to <16 x i8>
243243
// CHECK-A32-NEXT: [[VRNDXQ_V_I:%.*]] = bitcast <16 x i8> [[TMP1]] to <4 x float>
244-
// CHECK-A32-NEXT: [[VRNDXQ_V1_I:%.*]] = call <4 x float> @llvm.arm.neon.vrintx.v4f32(<4 x float> [[VRNDXQ_V_I]])
244+
// CHECK-A32-NEXT: [[VRNDXQ_V1_I:%.*]] = call <4 x float> @llvm.rint.v4f32(<4 x float> [[VRNDXQ_V_I]])
245245
// CHECK-A32-NEXT: [[VRNDXQ_V2_I:%.*]] = bitcast <4 x float> [[VRNDXQ_V1_I]] to <16 x i8>
246246
// CHECK-A32-NEXT: [[TMP2:%.*]] = bitcast <16 x i8> [[VRNDXQ_V2_I]] to <4 x i32>
247247
// CHECK-A32-NEXT: [[TMP3:%.*]] = bitcast <4 x i32> [[TMP2]] to <4 x float>

clang/test/CodeGen/arm-v8.2a-neon-intrinsics.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -682,7 +682,7 @@ float16x8_t test_vrndpq_f16(float16x8_t a) {
682682
// CHECK-NEXT: [[TMP0:%.*]] = bitcast <4 x half> [[A]] to <4 x i16>
683683
// CHECK-NEXT: [[TMP1:%.*]] = bitcast <4 x i16> [[TMP0]] to <8 x i8>
684684
// CHECK-NEXT: [[VRNDX_V_I:%.*]] = bitcast <8 x i8> [[TMP1]] to <4 x half>
685-
// CHECK-NEXT: [[VRNDX_V1_I:%.*]] = call <4 x half> @llvm.arm.neon.vrintx.v4f16(<4 x half> [[VRNDX_V_I]])
685+
// CHECK-NEXT: [[VRNDX_V1_I:%.*]] = call <4 x half> @llvm.rint.v4f16(<4 x half> [[VRNDX_V_I]])
686686
// CHECK-NEXT: [[VRNDX_V2_I:%.*]] = bitcast <4 x half> [[VRNDX_V1_I]] to <8 x i8>
687687
// CHECK-NEXT: [[TMP2:%.*]] = bitcast <8 x i8> [[VRNDX_V2_I]] to <4 x i16>
688688
// CHECK-NEXT: [[TMP3:%.*]] = bitcast <4 x i16> [[TMP2]] to <4 x half>
@@ -698,7 +698,7 @@ float16x4_t test_vrndx_f16(float16x4_t a) {
698698
// CHECK-NEXT: [[TMP0:%.*]] = bitcast <8 x half> [[A]] to <8 x i16>
699699
// CHECK-NEXT: [[TMP1:%.*]] = bitcast <8 x i16> [[TMP0]] to <16 x i8>
700700
// CHECK-NEXT: [[VRNDXQ_V_I:%.*]] = bitcast <16 x i8> [[TMP1]] to <8 x half>
701-
// CHECK-NEXT: [[VRNDXQ_V1_I:%.*]] = call <8 x half> @llvm.arm.neon.vrintx.v8f16(<8 x half> [[VRNDXQ_V_I]])
701+
// CHECK-NEXT: [[VRNDXQ_V1_I:%.*]] = call <8 x half> @llvm.rint.v8f16(<8 x half> [[VRNDXQ_V_I]])
702702
// CHECK-NEXT: [[VRNDXQ_V2_I:%.*]] = bitcast <8 x half> [[VRNDXQ_V1_I]] to <16 x i8>
703703
// CHECK-NEXT: [[TMP2:%.*]] = bitcast <16 x i8> [[VRNDXQ_V2_I]] to <8 x i16>
704704
// CHECK-NEXT: [[TMP3:%.*]] = bitcast <8 x i16> [[TMP2]] to <8 x half>

flang/lib/Parser/preprocessor.cpp

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1276,16 +1276,20 @@ static std::int64_t ExpressionValue(const TokenSequence &token,
12761276
left = right >= 64 ? 0 : left >> right;
12771277
break;
12781278
case BITAND:
1279-
case AND:
12801279
left = left & right;
12811280
break;
12821281
case BITXOR:
12831282
left = left ^ right;
12841283
break;
12851284
case BITOR:
1286-
case OR:
12871285
left = left | right;
12881286
break;
1287+
case AND:
1288+
left = left && right;
1289+
break;
1290+
case OR:
1291+
left = left || right;
1292+
break;
12891293
case LT:
12901294
left = -(left < right);
12911295
break;

flang/lib/Parser/token-sequence.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,8 @@ void TokenSequence::clear() {
3030

3131
void TokenSequence::pop_back() {
3232
CHECK(!start_.empty());
33-
CHECK(nextStart_ > start_.back());
33+
// If the last token is empty then `nextStart_ == start_.back()`.
34+
CHECK(nextStart_ >= start_.back());
3435
std::size_t bytes{nextStart_ - start_.back()};
3536
nextStart_ = start_.back();
3637
start_.pop_back();
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
! RUN: %flang_fc1 -fsyntax-only -cpp %s 2>&1
2+
#define UNITY(k) 1_ ## k
3+
PROGRAM REPRODUCER
4+
WRITE(*,*) UNITY(4)
5+
END PROGRAM REPRODUCER
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
!RUN: %flang_fc1 -cpp -fdebug-unparse %s | FileCheck %s
2+
PROGRAM P
3+
#if (1 && 2)
4+
!CHECK: TRUE
5+
WRITE(*,*) 'TRUE'
6+
#else
7+
!CHECK-NOT: FALSE
8+
WRITE(*,*) 'FALSE'
9+
#endif
10+
#if ((1 || 2) != 3)
11+
!CHECK: TRUE
12+
WRITE(*,*) 'TRUE'
13+
#else
14+
!CHECK-NOT: FALSE
15+
WRITE(*,*) 'FALSE'
16+
#endif
17+
END PROGRAM
18+

llvm/include/llvm/IR/IntrinsicsARM.td

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -679,7 +679,6 @@ def int_arm_neon_vtbx4 : Neon_Tbl6Arg_Intrinsic;
679679

680680
// Vector and Scalar Rounding.
681681
def int_arm_neon_vrintn : Neon_1FloatArg_Intrinsic;
682-
def int_arm_neon_vrintx : Neon_1Arg_Intrinsic;
683682

684683
// De-interleaving vector loads from N-element structures.
685684
// Source operands are the address and alignment.

llvm/lib/IR/AutoUpgrade.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -722,7 +722,8 @@ static bool upgradeArmOrAarch64IntrinsicFunction(bool IsArm, Function *F,
722722
.StartsWith("vrinta.", Intrinsic::round)
723723
.StartsWith("vrintm.", Intrinsic::floor)
724724
.StartsWith("vrintp.", Intrinsic::ceil)
725-
.StartsWith("vrintz", Intrinsic::trunc)
725+
.StartsWith("vrintx.", Intrinsic::rint)
726+
.StartsWith("vrintz.", Intrinsic::trunc)
726727
.Default(Intrinsic::not_intrinsic);
727728
if (ID != Intrinsic::not_intrinsic) {
728729
NewFn = Intrinsic::getOrInsertDeclaration(F->getParent(), ID,

llvm/lib/Target/ARM/ARMISelLowering.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1552,6 +1552,8 @@ ARMTargetLowering::ARMTargetLowering(const TargetMachine &TM_,
15521552
setOperationAction(ISD::FCEIL, MVT::v4f32, Legal);
15531553
setOperationAction(ISD::FTRUNC, MVT::v2f32, Legal);
15541554
setOperationAction(ISD::FTRUNC, MVT::v4f32, Legal);
1555+
setOperationAction(ISD::FRINT, MVT::v2f32, Legal);
1556+
setOperationAction(ISD::FRINT, MVT::v4f32, Legal);
15551557
}
15561558

15571559
if (Subtarget->hasFullFP16()) {
@@ -1573,6 +1575,8 @@ ARMTargetLowering::ARMTargetLowering(const TargetMachine &TM_,
15731575
setOperationAction(ISD::FCEIL, MVT::v8f16, Legal);
15741576
setOperationAction(ISD::FTRUNC, MVT::v4f16, Legal);
15751577
setOperationAction(ISD::FTRUNC, MVT::v8f16, Legal);
1578+
setOperationAction(ISD::FRINT, MVT::v4f16, Legal);
1579+
setOperationAction(ISD::FRINT, MVT::v8f16, Legal);
15761580
}
15771581
}
15781582

0 commit comments

Comments
 (0)