{"action":"created","comment":{"url":"https://api.github.com/repos/halide/Halide/pulls/comments/59263808","id":59263808,"diff_hunk":"@@ -1636,6 +1636,39 @@ inline Expr count_trailing_zeros(Expr x) {\n                                 {x}, Internal::Call::PureIntrinsic);\n }\n \n+/** Divide two integers, rounding towards zero. This is the typical\n+ * behavior of most hardware architectures, which differs from\n+ * Halide's division operator, which is Euclidean (rounds towards\n+ * -infinity). */\n+inline Expr div_round_to_zero(Expr x, Expr y) {\n+    Internal::match_types(x, y);\n+    if (x.type().is_uint()) {\n+        return x / y;\n+    }\n+    user_assert(x.type().is_int()) << \"div_round_to_zero only takes integer arguments\\n\";\n+    user_assert(y.type().is_int()) << \"div_round_to_zero only takes integer arguments\\n\";","path":"src/IROperator.h","position":14,"original_position":14,"commit_id":"6c2d0ae8c04d16d69cd15e9a09a516332e382b6c","original_commit_id":"6c2d0ae8c04d16d69cd15e9a09a516332e382b6c","user":{"login":"abadams","id":515398,"avatar_url":"https://avatars.githubusercontent.com/u/515398?v=3","gravatar_id":"","url":"https://api.github.com/users/abadams","html_url":"https://github.com/abadams","followers_url":"https://api.github.com/users/abadams/followers","following_url":"https://api.github.com/users/abadams/following{/other_user}","gists_url":"https://api.github.com/users/abadams/gists{/gist_id}","starred_url":"https://api.github.com/users/abadams/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/abadams/subscriptions","organizations_url":"https://api.github.com/users/abadams/orgs","repos_url":"https://api.github.com/users/abadams/repos","events_url":"https://api.github.com/users/abadams/events{/privacy}","received_events_url":"https://api.github.com/users/abadams/received_events","type":"User","site_admin":false},"body":"The error message is the same in these two cases, so why two distinct asserts?","created_at":"2016-04-11T19:16:30Z","updated_at":"2016-04-11T19:16:30Z","html_url":"https://github.com/halide/Halide/pull/1110#discussion_r59263808","pull_request_url":"https://api.github.com/repos/halide/Halide/pulls/1110","_links":{"self":{"href":"https://api.github.com/repos/halide/Halide/pulls/comments/59263808"},"html":{"href":"https://github.com/halide/Halide/pull/1110#discussion_r59263808"},"pull_request":{"href":"https://api.github.com/repos/halide/Halide/pulls/1110"}}},"pull_request":{"url":"https://api.github.com/repos/halide/Halide/pulls/1110","id":66015910,"html_url":"https://github.com/halide/Halide/pull/1110","diff_url":"https://github.com/halide/Halide/pull/1110.diff","patch_url":"https://github.com/halide/Halide/pull/1110.patch","issue_url":"https://api.github.com/repos/halide/Halide/issues/1110","number":1110,"state":"open","locked":false,"title":"Further refactoring of CodeGen_LLVM's Div visitor.","user":{"login":"dsharletg","id":7494796,"avatar_url":"https://avatars.githubusercontent.com/u/7494796?v=3","gravatar_id":"","url":"https://api.github.com/users/dsharletg","html_url":"https://github.com/dsharletg","followers_url":"https://api.github.com/users/dsharletg/followers","following_url":"https://api.github.com/users/dsharletg/following{/other_user}","gists_url":"https://api.github.com/users/dsharletg/gists{/gist_id}","starred_url":"https://api.github.com/users/dsharletg/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dsharletg/subscriptions","organizations_url":"https://api.github.com/users/dsharletg/orgs","repos_url":"https://api.github.com/users/dsharletg/repos","events_url":"https://api.github.com/users/dsharletg/events{/privacy}","received_events_url":"https://api.github.com/users/dsharletg/received_events","type":"User","site_admin":false},"body":"This PR uses Halide IR to define our euclidean division instructions, which makes them take advantage of CodeGen specializations (e.g. overridden handlers for shifts and bitwise ops).","created_at":"2016-04-11T15:44:04Z","updated_at":"2016-04-11T19:16:30Z","closed_at":null,"merged_at":null,"merge_commit_sha":"f91c3949b60cade1daa47e97457a1cbe5ca5b21c","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/halide/Halide/pulls/1110/commits","review_comments_url":"https://api.github.com/repos/halide/Halide/pulls/1110/comments","review_comment_url":"https://api.github.com/repos/halide/Halide/pulls/comments{/number}","comments_url":"https://api.github.com/repos/halide/Halide/issues/1110/comments","statuses_url":"https://api.github.com/repos/halide/Halide/statuses/6c2d0ae8c04d16d69cd15e9a09a516332e382b6c","head":{"label":"halide:codegen-shifts","ref":"codegen-shifts","sha":"6c2d0ae8c04d16d69cd15e9a09a516332e382b6c","user":{"login":"halide","id":1548551,"avatar_url":"https://avatars.githubusercontent.com/u/1548551?v=3","gravatar_id":"","url":"https://api.github.com/users/halide","html_url":"https://github.com/halide","followers_url":"https://api.github.com/users/halide/followers","following_url":"https://api.github.com/users/halide/following{/other_user}","gists_url":"https://api.github.com/users/halide/gists{/gist_id}","starred_url":"https://api.github.com/users/halide/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/halide/subscriptions","organizations_url":"https://api.github.com/users/halide/orgs","repos_url":"https://api.github.com/users/halide/repos","events_url":"https://api.github.com/users/halide/events{/privacy}","received_events_url":"https://api.github.com/users/halide/received_events","type":"Organization","site_admin":false},"repo":{"id":5241312,"name":"Halide","full_name":"halide/Halide","owner":{"login":"halide","id":1548551,"avatar_url":"https://avatars.githubusercontent.com/u/1548551?v=3","gravatar_id":"","url":"https://api.github.com/users/halide","html_url":"https://github.com/halide","followers_url":"https://api.github.com/users/halide/followers","following_url":"https://api.github.com/users/halide/following{/other_user}","gists_url":"https://api.github.com/users/halide/gists{/gist_id}","starred_url":"https://api.github.com/users/halide/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/halide/subscriptions","organizations_url":"https://api.github.com/users/halide/orgs","repos_url":"https://api.github.com/users/halide/repos","events_url":"https://api.github.com/users/halide/events{/privacy}","received_events_url":"https://api.github.com/users/halide/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/halide/Halide","description":"a language for image processing and computational photography","fork":false,"url":"https://api.github.com/repos/halide/Halide","forks_url":"https://api.github.com/repos/halide/Halide/forks","keys_url":"https://api.github.com/repos/halide/Halide/keys{/key_id}","collaborators_url":"https://api.github.com/repos/halide/Halide/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/halide/Halide/teams","hooks_url":"https://api.github.com/repos/halide/Halide/hooks","issue_events_url":"https://api.github.com/repos/halide/Halide/issues/events{/number}","events_url":"https://api.github.com/repos/halide/Halide/events","assignees_url":"https://api.github.com/repos/halide/Halide/assignees{/user}","branches_url":"https://api.github.com/repos/halide/Halide/branches{/branch}","tags_url":"https://api.github.com/repos/halide/Halide/tags","blobs_url":"https://api.github.com/repos/halide/Halide/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/halide/Halide/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/halide/Halide/git/refs{/sha}","trees_url":"https://api.github.com/repos/halide/Halide/git/trees{/sha}","statuses_url":"https://api.github.com/repos/halide/Halide/statuses/{sha}","languages_url":"https://api.github.com/repos/halide/Halide/languages","stargazers_url":"https://api.github.com/repos/halide/Halide/stargazers","contributors_url":"https://api.github.com/repos/halide/Halide/contributors","subscribers_url":"https://api.github.com/repos/halide/Halide/subscribers","subscription_url":"https://api.github.com/repos/halide/Halide/subscription","commits_url":"https://api.github.com/repos/halide/Halide/commits{/sha}","git_commits_url":"https://api.github.com/repos/halide/Halide/git/commits{/sha}","comments_url":"https://api.github.com/repos/halide/Halide/comments{/number}","issue_comment_url":"https://api.github.com/repos/halide/Halide/issues/comments{/number}","contents_url":"https://api.github.com/repos/halide/Halide/contents/{+path}","compare_url":"https://api.github.com/repos/halide/Halide/compare/{base}...{head}","merges_url":"https://api.github.com/repos/halide/Halide/merges","archive_url":"https://api.github.com/repos/halide/Halide/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/halide/Halide/downloads","issues_url":"https://api.github.com/repos/halide/Halide/issues{/number}","pulls_url":"https://api.github.com/repos/halide/Halide/pulls{/number}","milestones_url":"https://api.github.com/repos/halide/Halide/milestones{/number}","notifications_url":"https://api.github.com/repos/halide/Halide/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/halide/Halide/labels{/name}","releases_url":"https://api.github.com/repos/halide/Halide/releases{/id}","deployments_url":"https://api.github.com/repos/halide/Halide/deployments","created_at":"2012-07-31T04:05:25Z","updated_at":"2016-04-08T08:33:39Z","pushed_at":"2016-04-11T19:12:58Z","git_url":"git://github.com/halide/Halide.git","ssh_url":"git@github.com:halide/Halide.git","clone_url":"https://github.com/halide/Halide.git","svn_url":"https://github.com/halide/Halide","homepage":"http://halide-lang.org","size":244401,"stargazers_count":1250,"watchers_count":1250,"language":"C++","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":246,"mirror_url":null,"open_issues_count":164,"forks":246,"open_issues":164,"watchers":1250,"default_branch":"master"}},"base":{"label":"halide:master","ref":"master","sha":"fcc4a42504da54f4ba82851f0519fa692a39509f","user":{"login":"halide","id":1548551,"avatar_url":"https://avatars.githubusercontent.com/u/1548551?v=3","gravatar_id":"","url":"https://api.github.com/users/halide","html_url":"https://github.com/halide","followers_url":"https://api.github.com/users/halide/followers","following_url":"https://api.github.com/users/halide/following{/other_user}","gists_url":"https://api.github.com/users/halide/gists{/gist_id}","starred_url":"https://api.github.com/users/halide/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/halide/subscriptions","organizations_url":"https://api.github.com/users/halide/orgs","repos_url":"https://api.github.com/users/halide/repos","events_url":"https://api.github.com/users/halide/events{/privacy}","received_events_url":"https://api.github.com/users/halide/received_events","type":"Organization","site_admin":false},"repo":{"id":5241312,"name":"Halide","full_name":"halide/Halide","owner":{"login":"halide","id":1548551,"avatar_url":"https://avatars.githubusercontent.com/u/1548551?v=3","gravatar_id":"","url":"https://api.github.com/users/halide","html_url":"https://github.com/halide","followers_url":"https://api.github.com/users/halide/followers","following_url":"https://api.github.com/users/halide/following{/other_user}","gists_url":"https://api.github.com/users/halide/gists{/gist_id}","starred_url":"https://api.github.com/users/halide/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/halide/subscriptions","organizations_url":"https://api.github.com/users/halide/orgs","repos_url":"https://api.github.com/users/halide/repos","events_url":"https://api.github.com/users/halide/events{/privacy}","received_events_url":"https://api.github.com/users/halide/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/halide/Halide","description":"a language for image processing and computational photography","fork":false,"url":"https://api.github.com/repos/halide/Halide","forks_url":"https://api.github.com/repos/halide/Halide/forks","keys_url":"https://api.github.com/repos/halide/Halide/keys{/key_id}","collaborators_url":"https://api.github.com/repos/halide/Halide/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/halide/Halide/teams","hooks_url":"https://api.github.com/repos/halide/Halide/hooks","issue_events_url":"https://api.github.com/repos/halide/Halide/issues/events{/number}","events_url":"https://api.github.com/repos/halide/Halide/events","assignees_url":"https://api.github.com/repos/halide/Halide/assignees{/user}","branches_url":"https://api.github.com/repos/halide/Halide/branches{/branch}","tags_url":"https://api.github.com/repos/halide/Halide/tags","blobs_url":"https://api.github.com/repos/halide/Halide/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/halide/Halide/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/halide/Halide/git/refs{/sha}","trees_url":"https://api.github.com/repos/halide/Halide/git/trees{/sha}","statuses_url":"https://api.github.com/repos/halide/Halide/statuses/{sha}","languages_url":"https://api.github.com/repos/halide/Halide/languages","stargazers_url":"https://api.github.com/repos/halide/Halide/stargazers","contributors_url":"https://api.github.com/repos/halide/Halide/contributors","subscribers_url":"https://api.github.com/repos/halide/Halide/subscribers","subscription_url":"https://api.github.com/repos/halide/Halide/subscription","commits_url":"https://api.github.com/repos/halide/Halide/commits{/sha}","git_commits_url":"https://api.github.com/repos/halide/Halide/git/commits{/sha}","comments_url":"https://api.github.com/repos/halide/Halide/comments{/number}","issue_comment_url":"https://api.github.com/repos/halide/Halide/issues/comments{/number}","contents_url":"https://api.github.com/repos/halide/Halide/contents/{+path}","compare_url":"https://api.github.com/repos/halide/Halide/compare/{base}...{head}","merges_url":"https://api.github.com/repos/halide/Halide/merges","archive_url":"https://api.github.com/repos/halide/Halide/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/halide/Halide/downloads","issues_url":"https://api.github.com/repos/halide/Halide/issues{/number}","pulls_url":"https://api.github.com/repos/halide/Halide/pulls{/number}","milestones_url":"https://api.github.com/repos/halide/Halide/milestones{/number}","notifications_url":"https://api.github.com/repos/halide/Halide/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/halide/Halide/labels{/name}","releases_url":"https://api.github.com/repos/halide/Halide/releases{/id}","deployments_url":"https://api.github.com/repos/halide/Halide/deployments","created_at":"2012-07-31T04:05:25Z","updated_at":"2016-04-08T08:33:39Z","pushed_at":"2016-04-11T19:12:58Z","git_url":"git://github.com/halide/Halide.git","ssh_url":"git@github.com:halide/Halide.git","clone_url":"https://github.com/halide/Halide.git","svn_url":"https://github.com/halide/Halide","homepage":"http://halide-lang.org","size":244401,"stargazers_count":1250,"watchers_count":1250,"language":"C++","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":246,"mirror_url":null,"open_issues_count":164,"forks":246,"open_issues":164,"watchers":1250,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/halide/Halide/pulls/1110"},"html":{"href":"https://github.com/halide/Halide/pull/1110"},"issue":{"href":"https://api.github.com/repos/halide/Halide/issues/1110"},"comments":{"href":"https://api.github.com/repos/halide/Halide/issues/1110/comments"},"review_comments":{"href":"https://api.github.com/repos/halide/Halide/pulls/1110/comments"},"review_comment":{"href":"https://api.github.com/repos/halide/Halide/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/halide/Halide/pulls/1110/commits"},"statuses":{"href":"https://api.github.com/repos/halide/Halide/statuses/6c2d0ae8c04d16d69cd15e9a09a516332e382b6c"}}}}