| 1369 | return LLVMBuildTruncOrBitCast(Ref, Val.unwrap(), DestTy.unwrap(), Name); |
| 1370 | } |
| 1371 | Value createZExtOrTrunc(Value Val, Type DestTy, |
| 1372 | const char *Name = "") noexcept { |
| 1373 | const auto VTy = Val.getType(); |
| 1374 | assuming(DestTy.isIntegerTy() || DestTy.isVectorTy()); |
| 1375 | assuming(VTy.isIntegerTy() || VTy.isVectorTy()); |
| 1376 | const auto VTySize = VTy.getPrimitiveSizeInBits(); |
| 1377 | const auto DestTySize = DestTy.getPrimitiveSizeInBits(); |
| 1378 | if (VTySize < DestTySize) { |
| 1379 | return createZExt(Val, DestTy, Name); |
| 1380 | } |
| 1381 | if (VTySize > DestTySize) { |
| 1382 | return createTrunc(Val, DestTy, Name); |
| 1383 | } |
| 1384 | return Val; |
| 1385 | } |
| 1386 | Value createSExtOrTrunc(Value Val, Type DestTy, |
| 1387 | const char *Name = "") noexcept { |
| 1388 | const auto VTy = Val.getType(); |
no test coverage detected