File tree 2 files changed +24
-7
lines changed
2 files changed +24
-7
lines changed Original file line number Diff line number Diff line change @@ -1128,6 +1128,13 @@ bool SemanticsVisitor::coerceIntLitToBaseType(
1128
1128
case BaseType::UInt8 :
1129
1129
cost = kConversionCost_InRangeIntLitSignedToUnsignedConversion ;
1130
1130
break ;
1131
+ case BaseType::Float:
1132
+ case BaseType::Double:
1133
+ cost = kConversionCost_IntegerToFloatConversion ;
1134
+ break ;
1135
+ case BaseType::Half:
1136
+ cost = kConversionCost_IntegerToHalfConversion ;
1137
+ break ;
1131
1138
default :
1132
1139
cost = kConversionCost_InRangeIntLitConversion ;
1133
1140
break ;
@@ -1418,15 +1425,12 @@ bool SemanticsVisitor::_coerce(
1418
1425
return true ;
1419
1426
}
1420
1427
1428
+ if (auto toLitType = as<IntLiteralType>(toType))
1429
+ toType = (BasicExpressionType*)toLitType->getProperType ();
1430
+
1421
1431
if (auto fromIntLitType = as<IntLiteralType>(fromType))
1422
1432
{
1423
- auto toBasicType = as<BasicExpressionType>(toType);
1424
- if (!toBasicType)
1425
- {
1426
- if (auto toLitType = as<IntLiteralType>(toType))
1427
- toBasicType = (BasicExpressionType*)toLitType->getProperType ();
1428
- }
1429
- if (toBasicType)
1433
+ if (auto toBasicType = as<BasicExpressionType>(toType))
1430
1434
{
1431
1435
return coerceIntLitToBaseType (
1432
1436
fromIntLitType,
Original file line number Diff line number Diff line change
1
+
2
+ // TEST:SIMPLE(filecheck=CHECK):-target hlsl -entry computeMain -profile cs_6_0
3
+
4
+ RWStructuredBuffer < int > outputBuffer;
5
+
6
+ [numthreads(1 ,1 ,1 )]
7
+ void computeMain()
8
+ {
9
+ // CHECK: 4001
10
+ int8_t a = 1 ;
11
+ // we should resolve + to call +<int32_t> here.
12
+ outputBuffer [0 ] = a + 4000 ;
13
+ }
You can’t perform that action at this time.
0 commit comments