Skip to content

Handle builtin FP types in SILBuilder::appendOperandTypeName #17988

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Jul 17, 2018

Conversation

rxwei
Copy link
Contributor

@rxwei rxwei commented Jul 16, 2018

The following builder method doesn't handle floating point operands yet.

BuiltinInst *createBuiltinBinaryFunction(SILLocation Loc, StringRef Name,
                                         SILType OpdTy, SILType ResultTy,
                                         ArrayRef<SILValue> Args)

This patch adds support for calling this method with floating point operands.

SILValue x = ...; // $Builtin.FPIEEE32
B.createBuiltinBinaryFunction(loc, "fmul", x->getType(), x->getType(), { x, x })

Corresponding SIL:

%0 = builtin "fmul_FPIEEE32"(%x : $Builtin.FPIEEE32, %x : $Builtin.FPIEEE32) : $Builtin.FPIEEE32

The following builder method doesn't handle floating point operands yet.

```cpp
BuiltinInst *createBuiltinBinaryFunction(SILLocation Loc, StringRef Name,
                                            SILType OpdTy, SILType ResultTy,
                                            ArrayRef<SILValue> Args)
```

This patch adds support for calling this method with floating point operands.

```cpp
SILValue x = ...; // $Builtin.FPIEEE32
B.createBuiltinBinaryFunction(loc, "fmul", x->getType(), x->getType(), { x, x })
```

Corresponding SIL:
```
%0 = builtin "fmul_FPIEEE32"(%x : $Builtin.FPIEEE32, %x : $Builtin.FPIEEE32) : $Builtin.FPIEEE32
```
@rxwei
Copy link
Contributor Author

rxwei commented Jul 16, 2018

@swift-ci please smoke test

@rxwei rxwei requested a review from shajrawi July 16, 2018 22:49
@rxwei
Copy link
Contributor Author

rxwei commented Jul 16, 2018

@swift-ci please smoke test

1 similar comment
@rxwei
Copy link
Contributor Author

rxwei commented Jul 16, 2018

@swift-ci please smoke test

@shajrawi shajrawi merged commit 1609523 into master Jul 17, 2018
rxwei pushed a commit to rxwei/swift that referenced this pull request Jul 23, 2018
Handle builtin FP types in SILBuilder::appendOperandTypeName

(cherry picked from commit 1609523)
rxwei added a commit that referenced this pull request Jul 23, 2018
* Merge pull request #17988 from apple/rxwei-patch-2

Handle builtin FP types in SILBuilder::appendOperandTypeName

(cherry picked from commit 1609523)
@rxwei rxwei deleted the rxwei-patch-2 branch July 26, 2018 02:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants